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

Dmitriy Kargapolov <>
Thu Jun 15 17:31:49 CEST 2006


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



More information about the erlang-questions mailing list