[erlang-bugs] reproduceable livelock (?) in R13B04

Evgeniy Khramtsov <>
Thu Nov 18 19:19:11 CET 2010


19.11.2010 00:00, Matthias Lang wrote:
> Hi,
>
> while chasing a related bug, I found that the program below can get
> the beam VM into a state where it eats CPU but fails to make forward
> progress.
>
> I expect the program to print _something_ new at one second intervals,
> no matter what. Here's the program:
>
>     -module(poll).
>     -export([go/0]).
>
>     go() ->
>         file:delete("/tmp/pid"),
>         spawn(fun() ->  os:cmd("sleep 1; echo -n $?>  /tmp/pid") end),
>         wait_for_ev(),
>         go().
>
>     wait_for_ev() ->
>         case file:read_file("/tmp/pid") of
>     	{ok,<<>>} ->  io:fwrite("race!\n");
>     	{ok, _} ->  io:fwrite(".");
>     	{error, enoent} ->  wait_for_ev();
>     	X ->  io:fwrite("unexpected: ~p\n", [X])
>         end.
>
> On my dual-core 64-bit dual core desktop machine (SMP, the program runs as
> expected for a few minutes, printing various things, but then it
> produces no more output. 'top' says it's eating 100% CPU. That's happened
> within three minutes three times in a row now, i.e. it's reproduceable on
> that particular machine.
>    

Can't reproduce on R14B. Your program only eats CPU and prints "race!". 
I was waiting for several minutes and got no any locks.
I have four-core 64-bit machine.

-- 
Regards,
Evgeniy Khramtsov, ProcessOne.
xmpp:



More information about the erlang-bugs mailing list