bug in timer:sleep/1 smp implementation (R11B-0)

Dmitriy Kargapolov <>
Fri Jun 16 16:07:07 CEST 2006


I tried to make a small module for testing the problem, but in that case 
there has been no issue so far. I guess it's only happens in complex 
environment with thousand of processes and big volume network traffic.
Once I found anything I'll let you know.
Any ideas how to trace the problem are welcome.

Mikael Pettersson wrote:
> Dmitriy Kargapolov writes:
>  > 
>  > When running erl with -smp +S 2 option, sometimes process gets stuck in 
>  > timer:sleep/1.
>  > Process code looks like:
>  > 
>  > some_receiver(State) ->
>  >      NewState = receive
>  >          % legal packet
>  >          {some_keyword, Address, Port, Packet} ->
>  >              State1 = handle_packet(Address, Port, Packet, State),
>  >              timer:sleep(get_loop_delay()),
>  >              State1;
>  >          % unknown message
>  >          _ ->
>  >              State
>  >      end,
>  >      some_receiver(NewState).
>  > 
>  > Delay value varies in range 1..999
>  > 
>  > Since timer:sleep/1 implemented as:
>  > sleep(T) ->
>  >      receive
>  >      after T -> ok
>  >      end.
>  > it seems to be problem with "after" in smp implementation in R11B-0
>  > 
>  > I don't have more details yet but will continue testing.
>  > My platform: 2.6.9-5.ELsmp #1 SMP i686 i686 i386 GNU/Linux
>  
> Interesting. Please send us a small standalone module that exhibits
> the bug, and I'll see if I can reproduce it.
> 
> /Mikael
> 



More information about the erlang-questions mailing list