run: cannot load code on nodes that are in embedded mode
From user:
Erlide fails to launch a run/debug configuration that is set up to attach to a running node that was started in "embedded mode" (see http://www.erlang.org/doc/man/code.html). I think this is caused of the difference in behaviour of the code:ensure_loaded/1 function when running in embedded mode.
Details:
While trying to launch the run/debug configuration, I see log messages about adding paths such as:
21:06:47,508 F: (CodeManager.java:223) : adding /home/elageri/.eecs_eclipse/3.7.1_x86/plugins/org.erlide.kernel.builder_0.17.0.201206291158/ebin to code path for @21759820:: Runtime<OTP (/vobs/otp/otp_delivery/suse_x86) R15B01 []>
These operations seems to work fine (which I verified by checking code:get_paths() on the node), meaning that Erlide has contact with the node.
Directly after that, however, I get an error like this:
21:06:47,511 S: (Backend.java:337) : {badrpc,{'EXIT',{undef,[{erlide_kernel_common,init,[#Pid<jerlide_3633487@seasc0849.4.0>,false,false],[]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,203}]}]}}}
This seems to be because the erlide_kernel_common module has not been loaded, and indeed by looking on the node I can see that none of the erlide modules have been loaded.
By tracing on the node, I found that Erlide tries to use code:ensure_loaded/1 to load its modules. According to the documentation, in embedded mode "it does not load a module which is not already loaded, but returns {error, embedded} instead". Erlide seems to ignore this error. If I manually load all erlide modules using code:load_file, subsequent attempts to launch the run/debug configuration do succeed.
Erlide fails to launch a run/debug configuration that is set up to attach to a running node that was started in "embedded mode" (see http://www.erlang.org/doc/man/code.html). I think this is caused of the difference in behaviour of the code:ensure_loaded/1 function when running in embedded mode.
Details:
While trying to launch the run/debug configuration, I see log messages about adding paths such as:
21:06:47,508 F: (CodeManager.java:223) : adding /home/elageri/.eecs_eclipse/3.7.1_x86/plugins/org.erlide.kernel.builder_0.17.0.201206291158/ebin to code path for @21759820:: Runtime<OTP (/vobs/otp/otp_delivery/suse_x86) R15B01 []>
These operations seems to work fine (which I verified by checking code:get_paths() on the node), meaning that Erlide has contact with the node.
Directly after that, however, I get an error like this:
21:06:47,511 S: (Backend.java:337) : {badrpc,{'EXIT',{undef,[{erlide_kernel_common,init,[#Pid<jerlide_3633487@seasc0849.4.0>,false,false],[]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,203}]}]}}}
This seems to be because the erlide_kernel_common module has not been loaded, and indeed by looking on the node I can see that none of the erlide modules have been loaded.
By tracing on the node, I found that Erlide tries to use code:ensure_loaded/1 to load its modules. According to the documentation, in embedded mode "it does not load a module which is not already loaded, but returns {error, embedded} instead". Erlide seems to ignore this error. If I manually load all erlide modules using code:load_file, subsequent attempts to launch the run/debug configuration do succeed.
Leave a comment
on 2012-07-23 12:19 *
By Vlad Dumitrescu
Assigned to set to Vlad Dumitrescu
Component changed from None to building
Milestone set to sprint #33
Status changed from New to Test
Assigned to set to Vlad Dumitrescu
Component changed from None to building
Milestone set to sprint #33
Status changed from New to Test
Actually, we are using c:l() which in turn calls code:ensure_loaded(). We are now detecting if the node is in embedded mode and force load plugin code.