When I try to create a new process on separate node using

Pid = spawn(mynode, mymodule, myfunction, [self()])

(myfunction/1 is exported), I get this error:

Error in process <0.10.0> on node 'no@de1' with exit value:
{undef,[{mymodule, myfunction, [<33.64.0>], []}]}

I tried to set -compile(export_all) flag, but assuming the additional braces in error log, this is not the case. I don't know what causes the error and I have no clue what to do.

有帮助吗?

解决方案

The error you get is saying “There is no module ‘mymodule’ and/or no function ‘mymodule:myfunction/1’”.
This means mymodule is not loaded in the code server of your separate node.
To load mymodule's code there you need something like this snippet or this function

其他提示

Did you check that the module mymodule is in the path of no@de1?

When you spwan a process using spawn(mynode, mymodule, myfunction, [self()]), the VM needs to load the code before executing it.

If you use a high order function (a fun) in this way spawn(Node, Fun), then in is not more necessary to have the code in the path (but beware that any call to a function in the function definition need to be solved on the remote node)

go to no@de1 and run m(mymodule). It should clarify if the module is loadable and which functions does export.

also: check if the other node is reachable. Do a net_adm:ping on it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top