Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running erlang code only startup a console #113

Open
sylane opened this issue May 19, 2013 · 6 comments
Open

Running erlang code only startup a console #113

sylane opened this issue May 19, 2013 · 6 comments

Comments

@sylane
Copy link

sylane commented May 19, 2013

System: Ubuntu 12.10 64 bits, Eclipse 3.8 with erlide release and Erlang R16B.

When running, debugging or getting the coverage of an erlang module, erlide only startup a console. If the function is run form the started console it works fine but the function is not called automatically.

The erlang application is correctly configured with module, function and arguments, and when eclipse is requested to run it no exception are shown in the console:

19:13:34,294 F: (ErlangLaunchDelegate.java:90) : doLaunch runtime r16b
19:13:34,294 F: (ErlangLaunchDelegate.java:91) : doLaunch cookie erlide (erlide)
19:13:34,295 I: (RuntimeData.java:307) : Data:: org.erlide.backend.BackendData
19:13:34,295 I: (RuntimeData.java:316) : beamLocator         : org.erlide.model.BeamLocator@6b31d5c8
19:13:34,295 I: (RuntimeData.java:316) : launch              : org.eclipse.debug.core.Launch@3d914329
19:13:34,296 I: (RuntimeData.java:316) : projects            : [P/test]
19:13:34,296 I: (RuntimeData.java:316) : cookie              : erlide
19:13:34,296 I: (RuntimeData.java:316) : managed             : true
19:13:34,296 I: (RuntimeData.java:316) : restartable         : false
19:13:34,297 I: (RuntimeData.java:316) : startShell          : true
19:13:34,297 I: (RuntimeData.java:316) : console             : true
19:13:34,297 I: (RuntimeData.java:316) : interpretedModules  : [test:dummy.erl]
19:13:34,297 I: (RuntimeData.java:316) : nodeName            : dummy
19:13:34,298 I: (RuntimeData.java:316) : longName            : true
19:13:34,298 I: (RuntimeData.java:316) : extraArgs           : 
9:13:34,298 I: (RuntimeData.java:316) : workingDir          : .
19:13:34,298 I: (RuntimeData.java:316) : env                 : {}
19:13:34,299 I: (RuntimeData.java:316) : initialCall         : dummy:paftoto
19:13:34,299 I: (RuntimeData.java:316) : debugFlags          : [DISTRIBUTED_DEBUG, ATTACH_ON_BREAKPOINT]
19:13:34,299 I: (RuntimeData.java:316) : loadOnAllNodes      : true
19:13:34,300 I: (RuntimeData.java:316) : internal            : false
19:13:34,303 I: (RuntimeData.java:316) : runtimeInfo         : Runtime
19:13:34,303 I: (RuntimeData.java:316) : debug               : false
19:13:34,303 I: (RuntimeData.java:316) : reportErrors        : false
19:13:34,303 I: (RuntimeData.java:326) : ---------------
19:13:34,304 F: (ErlangLaunchDelegate.java:164) : START node :> [/usr/local/otp/r16b/bin/erl, -name, [email protected], -setcookie, erlide] *** /opt
19:13:34,305 F: (ErlangLaunchDelegate.java:183) : process is running
19:13:34,306 F: (ErlangLaunchDelegate.java:143) : Started erts: dummy >> dummy
19:13:34,306 F: (BackendManager.java:134) : create execution backend dummy
19:13:34,307 F: (BackendFactory.java:81) : Create backend dummy
19:13:34,308 F: (ErlRuntime.java:383) : using cookie 'erlide...'6 (info: 'erlide')
19:13:34,308 F: (ErlRuntime.java:468) : [email protected]: waiting connection to peer...
19:13:34,409 F: (ErlRuntime.java:164) : # [email protected] Worker-2
19:13:34,417 F: (ErlRuntime.java:103) : Node [email protected] is up
19:13:34,417 F: (ErlRuntime.java:164) : # [email protected] Worker-2
19:13:34,439 S: (ErlRuntime.java:551) : code server did not start in time for [email protected]
19:13:34,439 S: (ErlRuntime.java:476) : Could not connect to backend! Please check runtime settings.
19:13:34,456 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.kernel.debugger_0.20.1.201304230851/ebin to code path for @658853650:: Runtime
19:13:34,475 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.test_support_0.20.2.201304230851/ebin to code path for @658853650:: Runtime
19:13:34,490 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.tracing.ttbe_0.1.6.201304230851/ebin to code path for @658853650:: Runtime
19:13:34,498 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.tracing.erlang_0.2.8.201304230851/ebin to code path for @658853650:: Runtime
19:13:34,507 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.kernel.ide_0.20.2.201304230851/ebin to code path for @658853650:: Runtime
19:13:34,520 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.kernel.common_0.20.1.201304230851/ebin to code path for @658853650:: Runtime
19:13:34,526 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.cover.erlang_0.2.4.201304230851/ebin to code path for @658853650:: Runtime
19:13:34,536 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.wrangler.core_0.9.9.201304230851/wrangler/ebin to code path for @658853650:: Runtime
19:13:34,542 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.wrangler.core_0.9.9.201304230851/wrangler/app to code path for @658853650:: Runtime
19:13:34,547 F: (CodeManager.java:223) : adding /opt/eclipse/plugins/org.erlide.kernel.builder_0.20.1.201304230851/ebin to code path for @658853650:: Runtime
19:13:34,548 F: (Backend.java:180) : initialize [email protected]: true
19:13:34,560 F: (Backend.java:281) : backend [email protected]: add path /home/sylane/workspace/test/ebin
19:13:34,566 F: (Backend.java:407) : calling startup function dummy:paf
19:13:34,567 F: (ErlConsoleManager.java:42) : console ADDED to org.erlide.backend.BackendData@1ac7c44d

The same happens when configuring only the module and function without arguments.

@sylane
Copy link
Author

sylane commented May 19, 2013

The only weird things I see is: code server did not start in time for [email protected]

@vladdu
Copy link
Collaborator

vladdu commented May 19, 2013

How do you test that your function is called at startup? io:format is not a reliable way to do that.

@sylane
Copy link
Author

sylane commented May 19, 2013

ok, you are right on this, thank you.
If I write to a file I can see that my code is called.
What made me think it wasn't working in the first place was that breakpoint were not working.
But it seems breakpoint are working every second times I debug the module.
It works one time out of two and the console are accumulating themselves.

I am playing with eunit/coverage/tracing and until now I wasn't able to make anything works.
I tough these problems were all related to the same issue, but it seems it is not the case.

If the console output is not reliable how am I supposed to see the output of eunit tests ?

@sylane
Copy link
Author

sylane commented May 19, 2013

I tried debugging with an external module with the command:

erl -pa /opt/eclipse/plugins/org.erlide.tracing.ttbe_0.1.6.201304230851/ebin -n-pa /opt/eclipse/plugs/org.erlide.kernel.debugger_0.20.1.201304230851/ebin -name dummy -setcookie dummy

The first time I debug the module everything works fine.

But the second time the external node shows the error:

=ERROR REPORT==== 19-May-2013::20:27:42 ===
Error in process <0.452.0> on node '[email protected]' with exit value: {badarg,[{erlang,register,[erlide_builder,<0.454.0>],[]},{erlide_batch,start,2,[]},{erlide_kernel_common,startup,4,[]}]}

Then the next time it works and son on and so on.

@vladdu
Copy link
Collaborator

vladdu commented May 19, 2013

I will comment a little more tomorrow, but when you use a startup function, you need to start a new node every time in order to run it.

The debug workflow is: start node, [] enter your "foo:bar().", check result or have the breakpoint trigger, correct code in editor, save (which compiles and reloads the code) and go to [] .

Don't start the node every time. If you have to do it, make sure you stop the previous instance.

@vladdu
Copy link
Collaborator

vladdu commented May 20, 2013

For an external module, you may want to restart the node from scratch, then like I said: stop the previous console. This will stop the debugger and it will not crash next time you start.

It's not obvious what one should do, so I created https://erlide-tools.assembla.com/spaces/erlide/tickets/1216 to track the issue.

Thanks!

@vladdu vladdu removed the assembla label Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants