[erlang-questions] inet_db:lookup_socket/1 failing for gen_tcp:controlling_process with mochiweb socket server

Paul Oliver puzza007@REDACTED
Mon Nov 24 22:08:07 CET 2008

Hi all,

I have a curious bug that I've tracked down to a call to
gen_tcp:controlling_process.  From the stack trace (simple example
reproduced below) it seems that the port in question definitely exists, but
the call to inet_db:lookup fails.  Has anyone seen this before or got any


Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0]

Eshell V5.6.5  (abort with ^G)
1> mochiweb_socket_server:start( [{ip, ""}, {loop, {connection,
start}}, {name, badger}, {port, 8888}]).
2> Sock = gen_tcp:connect('', 8888,  [binary, {packet, line},
{nodelay, true}], 3000000).
3> gen_tcp:controlling_process(Sock, self()).

=ERROR REPORT==== 24-Nov-2008::20:59:12 ===
** Generic server badger terminating
** Last message in was {'EXIT',<0.30.0>,
** When Server state == {mochiweb_socket_server,8888,
** Reason for termination ==
** {function_clause,[{inet_db,lookup_socket,[{ok,#Port<0.496>}]},
** exception exit: function_clause
     in function  inet_db:lookup_socket/1
        called as inet_db:lookup_socket({ok,#Port<0.496>})
     in call from gen_tcp:controlling_process/2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081124/de7826ea/attachment.htm>

More information about the erlang-questions mailing list