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

Raimo Niskanen <>
Wed May 14 11:41:31 CEST 2008


On Wed, May 14, 2008 at 10:50:55AM +0200, Raimo Niskanen wrote:
> On Wed, May 14, 2008 at 09:34:07AM +0200, Alexander Lamb wrote:
> > Is it important to dig further? Or can we (for the time being) suggest  
> > that on MacOSX NOT to use short names?
> > 

Sorry, I just had to test one final thing,
and I think I have reproduced your problem...

I tested on MacOS X Leopard uname -a:
Darwin foo 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar  4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
It has a fresh update of Java.

If I start the erlang node with -sname 
and then run my test program as:
foo$ java -DOtpConnection.trace=4 jrpc  `cat ~/.erlang.cookie`  hello
it behaves as you describe. And what is interesting is,
now from your trace, same in mine:
-> LOOKUP (r4) 
:
<- HANDSHAKE recvChallenge from= challenge=1257096912
: first send, now second...
-> LOOKUP (r4) 

So Jinterface looks up , finds and contacts
it, and gets replies from  An Erlang node
would have detected the difference in hostnames
and refused the connection, but Jinterface registers
the connection as being to , and when the
next messages is sent to , a new
lookup is made since the only existing connection
is to , and this time the Erlang node
detects a duplicate connection and closes it.

So there probably is no problem with long hostnames,
you just have to specify the hostname part of the
node name as -sname , not -sname alex.
And the MacOS X problem is probably a name resolution
problem for the domain .local.

But there is a bug that Jinterface does not refuse
the connection for mismatching hostname parts of
the node name, and thereby gets a faulty registered
connetion.



> > Of course, I can setup a test case, but being new to Erlang, I might  
> > not be looking for the right things.
> > Tell me if you want me to check some additional info!
> > 
> > To answer a previous question from Raimo, I traced the objects I use  
> > to connect (especially the mailbox) and I can confirm that my test was  
> > using only one object. Therefore, we are clearly in a situation where  
> > upon setting up the connection the lookup works one way and for  
> > following lookups it works in another way.
> 
> Ok, that is strange, might be a bug.
> 
> It is also strange that short names does not
> work at all. It does on other platforms.
> 
> But I do not feel a strong urge to investigate it
> right now. If long names works on MacOS X we can
> leave it at that for a the time being, but eventually
> we will have to look into it...
> 
> 
> > 
> > Alex
> > 
> > Le 14 mai 08 à 09:25, Vlad Dumitrescu a écrit :
> > 
> > > Hi,
> > >
> > > On Wed, May 14, 2008 at 9:04 AM, Alexander Lamb < 
> > > > wrote:
> > > 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.
> > >
> > > This could be the reason. Working with ErlIDE, I got many bug  
> > > reports about the connection between Java and Erlang not working on  
> > > OSX. I think almost all of them were caused by this mismatch between  
> > > how Java and Erlang look up hosts by name. We had to use long names  
> > > for the Erlang nodes.
> > >
> > > This doesn't really answer why it did work the first time. Like  
> > > Raimo said, maybe the connection is retried several times. The  
> > > connection can be closed for several reasons, for example if data  
> > > that can't be decoded is received. Hard to tell without any  
> > > additional info.
> > >
> > > regards,
> > > Vlad
> > >
> > >
> > >
> > 
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> 
> -- 
> 
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list