[erlang-bugs] bug report: ets:select/2 hangs and consumer 100% CPU

Sverker Eriksson <>
Tue Jul 6 17:40:59 CEST 2010

Knut Bakke wrote:
> Version R13B03, R14A
> Slogan: "ets:select/2 hangs and consumer 100% CPU"
> Very rarely, like 
> once very week on a 10 hrs running system pr day doing ets:select about 
> 10 times a sec, the system locks up in 100% CPU
> with ets:select/2 
> never returning.
> The table is very small, about 100 items, could be  
> less.
> Observations)
> 1) If the process with the hanging ets:select/2 is killed, the involved 
> table is deleted and rebuild with the exact same content. Applying the 
> same ets:select/2, same match spec, will cause a new hanging.
> 2) By deleting objects, one by one, the hang finally disappears (maybe after 20 objects have been 
> deleted).
> 3) The table is only accessed though ONE erlang process.
> 4) The table is of type [public, ordered_set]
> We have captured one 
> situation of a hang, writing out the match specification and dumping the ets table to file, using tab2file.
> The problem is reproducible by:
> 1) {ok,Tab}=ets:file2tab("EtsSelectHang_)20100628.txt").   %% Please let me know and I send the file. too big
> 2) ets:select(Tab,  
> [{{{guard,true,'$1','_','_','_','_','$2','_',undefined},'$9'},  
> [{'<','$1',63444947604},{'/=','$2',this}], ['$_']}]).
The hanging is triggered by an ets object with [] as key.
Empty lists are ok as keys, so this is bug. But it only happens in your 
case when the 1000th object from the end happens to be the one with 
empty list key.

/Sverker, Erlang/OTP Ericsson

More information about the erlang-bugs mailing list