[erlang-bugs] Bad object error in dets in R14B02

John Hughes <>
Mon May 16 18:23:21 CEST 2011


QuickCheck found another error in dets. The following test case shows how to provoke a bad object error by starting three concurrent match_object traversals, at the same time as data is inserted into the table.

test() ->
    dets:close(dets_table),
    file:delete(dets_table),   
    {ok,dets_table} = dets:open_file(dets_table,[{type,bag}]),
    ok = dets:insert(dets_table,[{0,0},{0,14},{1,0},{1,1},{39,0}]),  
    {[{0,14}],Cont} = dets:match_object(dets_table,{'$1',14},0),    
    ok = dets:insert(dets_table,{2,0}),                              
    {[{0,0},{0,14}],_} = dets:match_object(dets_table,{0,'$2'},0),
    ok = dets:insert(dets_table,[{2,1},{39,1}]),                     
    {[{1,0}],_} = dets:match_object(dets_table,{'$1',0},0),      
    {error,{{bad_object,scan},"dets_table"}} = dets:match_object(Cont).

This is 100% repeatable--and it seems to be a minimal example.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20110516/8bff70e3/attachment.html>


More information about the erlang-bugs mailing list