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

Mikael Pettersson <>
Thu Jun 15 18:28:27 CEST 2006


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