[erlang-questions] is inet:gethostbyname( IP ) correct?

Raimo Niskanen raimo+erlang-questions@REDACTED
Mon Nov 2 18:46:16 CET 2009


Thanks a lot for the feedback! Then this fix will be in the
next release.


On Wed, Oct 28, 2009 at 11:35:34AM +0000, Robert Raschke wrote:
> Hi Raimo.
> 
> On Fri, Oct 23, 2009 at 1:56 PM, Raimo Niskanen <
> raimo+erlang-questions@REDACTED<raimo%2Berlang-questions@REDACTED>
> > wrote:
> 
> > After a week of bug hunting we can confirm this is really
> > Microsoft's bug, but we have a workaround.
> > (It may be Microsoft's and Comodo's bug, who knows...)
> >
> > It turns out if you mix overlapped I/O with non-overlapped
> > (asyncronous with syncronous) on different pipes, in this
> > case the pipe to inet_gethost.exe from erlang was opened
> > by erlang as non-overlapped and inet_gethost.exe itself
> > used overlapped on all its other sockets and pipes...
> >
> > ...alright if you mix ... I/O something gets not initialized
> > in Microsoft's libs unless you do a gethostname() call
> > before going into recv() of commands from erlang (we already
> > found this out the hard way) but now also if you had certain
> > firewalls installed it was not enough, you had to do
> > gethostbyname() calls with longer domain names to
> > work around Microsoft's bug.
> >
> > Since this felt like a way to shaky workaround we found
> > another that seems much better: now erlang can open the
> > pipe to this specific port program (inet_gethost.exe)
> > for overlapped I/O so inet_gethost.exe now uses overlapped
> > I/O only. This seems to avoid the bug.
> >
> > We reproduced the name lookup freeze with Comodo 2.4.19.185
> > and Microsoft's Client for ISA Server 4.0. Here is
> > a snapshot build (without documentation) that
> > does not freeze for neither of these firewalls.
> >
> > http://www.erlang.org/download/snapshots/otp_win32_R13B03_gethost_fix.exe
> >
> > Try it and see if it solves your problem.
> >
> > / Raimo Niskanen
> >
> >
> >
> Congratulations! You have a winner.
> 
> I have gone through the following tests:
> 
> R13B02-1 on W2003, no Firewall Client for ISA
>         inet:gethostbyname("localhost").
>                 OK
>         inet:gethostbyname("local machine name").
>                 OK
>         inet:gethostbyname("machinename.localdomain").
>                 OK
>         inet:gethostbyname("www.google.com").
>                 OK
>         inet:gethostbyname("www.cisco.com").
>                 OK
> 
> R13B02-1 on W2003, with Firewall Client for ISA
>         inet:gethostbyname("localhost").
>                 OK
>         inet:gethostbyname("local machine name").
>                 OK
>         inet:gethostbyname("machinename.localdomain").
>                 OK
>         inet:gethostbyname("www.google.com").
>                 timeout
>         inet:gethostbyname("www.cisco.com").
>                 timeout
> 
> 
> R13B03_gethost_fix on W2003, no Firewall Client for ISA
>         inet:gethostbyname("localhost").
>                 OK
>         inet:gethostbyname("local machine name").
>                 OK
>         inet:gethostbyname("machinename.localdomain").
>                 OK
>         inet:gethostbyname("www.google.com").
>                 OK
>         inet:gethostbyname("www.cisco.com").
>                 OK
> 
> R13B03_gethost_fix on W2003, with Firewall Client for ISA
>         inet:gethostbyname("localhost").
>                 OK
>         inet:gethostbyname("local machine name").
>                 OK
>         inet:gethostbyname("machinename.localdomain").
>                 OK
>         inet:gethostbyname("www.google.com").
>                 OK
>         inet:gethostbyname("www.cisco.com").
>                 OK
> 
> 
> Brilliant work for tracking down this obscure behaviour.
> 
> Robby

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB


More information about the erlang-questions mailing list