[erlang-questions] : : First send from JInterface ok, second one blocs?? FOUND THE PROBLEM

Alexander Lamb <>
Wed May 14 09:04:40 CEST 2008


Answers in the text.

Le 13 mai 08 à 14:38, Raimo Niskanen a écrit :

> On Tue, May 13, 2008 at 12:27:05PM +0200, Alexander Lamb wrote:
>> Ok,
>>
>> I found the solution but I don't understand why:
>>
>> When I started the erlang server, I initially wrote:
>>
>> erl -mnesia -setcookie rodanotech -sname alex (notice the "sname")
>>
>> It started the node as
>>
>> ()1>
>>
>> But from my Java program I was forced to write:
>>
>> "" when sending a message from my mailbox.
>
> Why was you "forced to write" ?
> The example I tried used -sname  for
> the Erlang node and  for the java node.
> And while I wrote it I tried using the short host
> name a'la  and  (but not kirk), and it worked.

Because otherwise it wouldn't connect even though the node was started  
as 

Now, my impression is that this is a special effect of MacOSX (I am  
running the 10.5.2 on Intel with the latest version of Erlang). It is  
probable that the way name resolution works locally (the two nodes on  
my desktop) is different from Linux.

>
>
>>
>> For some unknown reason, the first call went ok, the any following  
>> one
>> didn't.
>
> That is strange since you can not mix long and short names
> in an Erlang network. Perhaps something is not quite
> as it should be in Jinterface regarding long vs. short
> node names.

Exactly, but imagine the first lookup (the one which will lead to  
create a connection between the two nodes) is done in one way, then  
the second lookup (once the connection is made) is done differently...

>
>
>>
>> I started a second erlang node to debug the problem and tried using:
>>
>> erl -mnesia -setcookie rodanotech -name alex (notice without the "s"
>> before name)
>>
>> It started:
>>
>> ()1>
>>
>> Now it works... but why did it work for each first call when using -
>> sname ??? That's what probably put me on the wrong direction to find
>> the solution!!
>>
>> Anyway, thanks a lot for all your help. Once all this is more or less
>> stable, I will try to write a small example to explain what we are
>> doing.
>>
>> Alex
>> --
>> Alexander Lamb
>> Founding Associate
>> RODANOTECH Sàrl
>>
>> 4 ch. de la Tour de Champel
>> 1206 Geneva
>> Switzerland
>>
>> Tel:  022 347 77 37
>> Fax: 022 347 77 38
>>
>> http://www.rodanotech.ch
>>
>>
>>
>>
>> Le 13 mai 08 à 12:13, Vlad Dumitrescu a écrit :
>>
>>> Hi,
>>>
>>> On Tue, May 13, 2008 at 12:04 PM, Alexander Lamb
>>> < > wrote:
>>> I added an OtpNodeStatus to follow the status of the connection  
>>> and on
>>> the second call here is what I get:
>>>
>>> -> LOOKUP (r4) 
>>> <- PORT 57266
>>> -> MD5 CONNECT TO kirk.local:57266
>>> -> HANDSHAKE sendName flags=3332 dist=5 local=
>>> -> CLOSE
>>> -- CONNECTION ATTEMPT:  INCOMING: false INFO:
>>> java.io.IOException: Cannot connect to peer node
>>>
>>> Because of the CLOSE, the connection attempt from  is
>>> refused!
>>>
>>> Can you set a breakpoint on AbstractConnection.close() and look at
>>> the stack to see who calls it? It would help to know.
>>>
>>> best regards,
>>> Vlad
>>>
>>
>>
>>
>>
>
> -- 
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>




More information about the erlang-questions mailing list