【发布时间】:2015-07-05 10:02:16
【问题描述】:
远程节点位于不同的机器上。
我从本地节点测试:
$ erl -name foobar
Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:2:2] [async-threads:10] [kernel-poll:false]
Eshell V6.2 (abort with ^G)
(foobar@debian.localdomain)1> Aliyun='aliyun@localhost2.localdomain'.
'aliyun@localhost2.localdomain'
(foobar@debian.localdomain)2> spawn(Aliyun, fun() -> io:format("hello~n") end).
<6108.86.0>
(foobar@debian.localdomain)3>
=ERROR REPORT==== 4-Jul-2015::21:03:27 ===
Error in process <0.86.0> on node 'aliyun@localhost2.localdomain' with exit value: {{badfun,#Fun<erl_eval.20.90072148>},[{erlang,apply,2,[]}]}
(foobar@debian.localdomain)3> spawn(Aliyun, io, format, ["hello~n"]).
hello
<6108.87.0>
(foobar@debian.localdomain)4> net_adm:ping(Aliyun).
pong
您可以看到 spawn(node,module,function,args) 有效,但 spawn(node,fun) 无效。
远程节点上的 Erlang 版本是 R15,而本地节点上的版本是 R17。是这个原因吗?因为代码格式不同?我不清楚 Erlang 在将 fun 类型传递给远程节点时如何对其进行编组。在字节码中?
请帮忙!
【问题讨论】:
标签: erlang