[erlang-bugs] ets:new/2 and ets:all/0 concurrency issue

Sverker Eriksson sverker.eriksson@REDACTED
Thu Feb 6 12:11:03 CET 2014


On 02/05/2014 05:39 PM, Florian Schintke wrote:
> Hi,
>
> suppose we call ets:new() and ets:all() in sequence. We expect to see
> the newly created table in the output of ets:all().
>
> If a single process calls ets:new() and ets:all() in sequence
> everything works as expected.
>
> If two concurrent processes A and B call ets:new() and ets:all(), it
> can happen that the table created by process A is not listed in
> ets:all() output of process A, or the table created by process B is
> not listed in ets:all() of process B. This violates the sequential
> semantics one would expect from sequential code.
>
Just to clearify on the subject of ets:all() and concurrency.

ets:all() does not give any guarantee of consistency. Each table created 
or deleted by other processes "during" the ets:all() call
may or may not be included in the result.

However, as pointed out, tables known to have been created/deleted 
*before* the call to ets:all() should of course be included/excluded in 
the result (or so they will in 17.0).


/Sverker, Erlang/OTP







More information about the erlang-bugs mailing list