[erlang-questions] erlang gen_tcp:connect/3 not working with rpc:call/4, anyone knows why?
Allen Kim
allen.kim@REDACTED
Thu Sep 22 21:53:46 CEST 2011
Thanks Magnus, and that works
BUT, it does not make sense to me.
errrrr, Mac, why don't you work like others?
~$ssh allen@REDACTED 'nohup erl -name loadtest@REDACTED -detached -setcookie loadtest'
~$ps aux | grep loadtest
allen 4137 0.5 0.1 2454316 10104 ?? S 3:49pm 0:00.12 /opt/local/lib/erlang/erts-5.8.4/bin/beam.smp -- -root /opt/local/lib/erlang -progname erl -- -home /Users/allen -- -name loadtest@REDACTED -noshell -noinput -setcookie loadtest
allen 3219 0.0 0.0 2435328 1440 s002 S+ 2:46pm 0:00.17 ssh azoogle@REDACTED
allen 4139 0.0 0.0 2435116 524 s005 S+ 3:49pm 0:00.00 grep loadtest
~$erl -name allen@REDACTED -setcookie loadtest
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.4 (abort with ^G)
(allen@REDACTED)1> net_adm:ping('loadtest@REDACTED').
pong
(allen@REDACTED)2> gen_tcp:connect("www.google.com",80,[]).
{ok,#Port<0.633>}
(allen@REDACTED)3> rpc:call('loadtest@REDACTED',gen_tcp,connect,["www.google.com",80,[]]).
{ok,#Port<5895.487>}
(allen@REDACTED)4>
Allen Kim
From: Magnus Klaar <magnus.klaar@REDACTED<mailto:magnus.klaar@REDACTED>>
Date: Thu, 22 Sep 2011 09:53:45 -0500
To: Allen Kim <allen.kim@REDACTED<mailto:allen.kim@REDACTED>>
Cc: Kaiduan Xie <kaiduanx@REDACTED<mailto:kaiduanx@REDACTED>>, "erlang-questions@REDACTED<mailto:erlang-questions@REDACTED>" <erlang-questions@REDACTED<mailto:erlang-questions@REDACTED>>
Subject: Re: [erlang-questions] erlang gen_tcp:connect/3 not working with rpc:call/4, anyone knows why?
Hi!
If it uses native lookups we can assume that getaddrinfo is broken when it is called from the detached node.
This narrows down the search for the cause of this issue to a more general problem with getaddrinfo on os-x,
leading us to this thread:
http://lists.apple.com/archives/unix-porting/2010/Jul/msg00001.html
You could try just adding nohup to the command that you're executing using ssh. Although i have a hard
time seeing how this would work. An erlang node started with -detached should ignore HUP signals (afaik).
MVH Magnus
On Wed, Sep 21, 2011 at 8:48 PM, Allen Kim <allen.kim@REDACTED<mailto:allen.kim@REDACTED>> wrote:
I don't see any difference from outputs from the following commands.
It both uses native lookup.
Anyway, it is not a big deal since I do not use Mac for staging nor production. it's only for development.
However, I hope it's better to be consistent on all kind of *nix environment.
Or, it could be me only.
Any Mac user who what to test this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110922/c88c6a16/attachment.htm>
More information about the erlang-questions
mailing list