[erlang-bugs] Bug in the resolver?

Ahmed Omar spawn.think@REDACTED
Tue Apr 12 11:24:28 CEST 2011


I think this should solve it, but i think someone from OTP team can verify
it

index de0f23b..9151cac 100644
--- a/lib/kernel/src/inet_res.erl
+++ b/lib/kernel/src/inet_res.erl
@@ -552,10 +552,10 @@ do_udp_recv(Recv, IP, Port, Timeout) ->

 do_udp_recv(Recv, IP, Port, Timeout, Then) ->
     case Recv(Timeout) of
+       {ok,_} when Timeout =:= 0 ->
+            {error,timeout};
        {ok,{IP,Port,Answer}} ->
            {ok,Answer,erlang:max(0, Timeout - now_ms(erlang:now(), Then))};
-       {ok,_} when Timeout =:= 0 ->
-           {error,timeout};
        {ok,_} ->
            Now = erlang:now(),
            T = erlang:max(0, Timeout - now_ms(Now, Then)),


On Tue, Apr 12, 2011 at 10:52 AM, Ahmed Omar <spawn.think@REDACTED> wrote:

> Actually it might be a bug. There's a clause in do_udp_recv/4 that will
> call do_upd_recv/5 with the value of Then as undefined.
> If this value passed to now_ms/2 , it will crash. The crash reason is
> converted to case_clause instead of function_clause because now_ms/2 is
> inlined.
>
>
> On Tue, Apr 12, 2011 at 10:27 AM, Ahmed Omar <spawn.think@REDACTED>wrote:
>
>> Any steps to reproduce it?
>>
>>
>> On Tue, Apr 12, 2011 at 8:25 AM, Evgeniy Khramtsov <xramtsov@REDACTED>wrote:
>>
>>> We have a weird problem with inet_res in R14B02. Here is a snippet:
>>>
>>> =ERROR REPORT==== 2011-04-11 18:45:50 ===
>>> ** State machine <0.6000.0> terminating
>>> ....
>>> ** Reason for termination =
>>> ** {{case_clause,{{1302,533150,198860},undefined}},
>>>    [{inet_res,do_udp_recv,5},
>>>     {inet_res,query_udp_recv,6},
>>>     {inet_res,query_ns,10},
>>>     {inet_res,query_nss_dns,7},
>>>     {inet_res,query_retries,6},
>>>     {inet_res,res_getby_query,4},
>>>     {inet_res,res_getby_search,6},
>>>     {inet_res,getbyname,3}]}
>>>
>>> Any clue how to debug this?
>>>
>>> --
>>> Regards,
>>> Evgeniy Khramtsov, ProcessOne.
>>> xmpp:xram@REDACTED
>>>
>>> _______________________________________________
>>> erlang-bugs mailing list
>>> erlang-bugs@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-bugs
>>>
>>
>>
>>
>> --
>> Best Regards,
>> - Ahmed Omar
>> http://nl.linkedin.com/in/adiaa
>> Follow me on twitter
>> @spawn_think <http://twitter.com/#!/spawn_think>
>>
>>
>
>
> --
> Best Regards,
> - Ahmed Omar
> http://nl.linkedin.com/in/adiaa
> Follow me on twitter
> @spawn_think <http://twitter.com/#!/spawn_think>
>
>


-- 
Best Regards,
- Ahmed Omar
http://nl.linkedin.com/in/adiaa
Follow me on twitter
@spawn_think <http://twitter.com/#!/spawn_think>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20110412/c9ba3cb9/attachment.htm>


More information about the erlang-bugs mailing list