inet_res:getbyname/2 and udp:connect/3

Dmitry Belyaev <>
Thu Jun 10 17:10:31 CEST 2010


I think, we've found a bug in inet_res.

It causes request to inet_res:getbyname/2 to respond {error, timeout} if 
*first* nameserver in /etc/resolv.conf inexistent (or down in my case).

I couldn't find any info about gen_udp:connect nor erlang:port_get_data/1.
But commenting following line helped. 
http://github.com/erlang/otp/blob/dev/lib/kernel/src/inet_res.erl#L676

query_udp(S, Id, Buffer, IP, Port, Timer, Retry, I, Tm, Verbose) ->
Timeout = inet:timeout( (Tm * (1 bsl I)) div Retry, Timer),
?verbose(Verbose, "Try UDP server : ~p:~p (timeout=~w)\n", [IP, Port, 
Timeout]),
%% udp_connect(S, IP, Port),
udp_send(S, IP, Port, Buffer),
query_udp_recv(S, IP, Port, Id, Timeout, Verbose).


Can anyone tell me is it really a bug? And what gen_udp:connect/3 do?

-- 
Dmitry Belyaev



More information about the erlang-questions mailing list