[erlang-questions] repeatable dets:insert() error

Daniel Goertzen <>
Tue Feb 5 20:46:34 CET 2008


dets:insert() unexpectedly fails upon inserting the 2,097,176th element in a
stress test program.  It happens on Windows with R11B, and linux with R12B.
It only seems to happen when inserting the term {N,{entry,N}}; the term
{N,{entry,another_entry,N} got past the 2.1M mark without error.  Anybody
know what's going on here?


Consider this dets stress tester:

go(make_dets) ->
    {ok,Mydets}=dets:open_file(mydets,[]),
    write_dets(Mydets),
    dets:close(Mydets).

write_dets(Tab) ->
    write_dets(Tab,0).

write_dets(Tab,N) ->
    case N rem 10000 of
        0 -> io:format("inserting ~p~n",[N]);
        _ -> ok
    end,
    ok=dets:insert(Tab,{N,{entry,N}}),
    write_dets(Tab,N+1).



With R11B on Windows I get:

...
inserting 2070000
inserting 2080000
inserting 2090000

=ERROR REPORT==== 5-Feb-2008::09:54:40 ===
Error in process <0.30.0> with exit value:
{badarg,[{dets,insert,[mydets,{209717
5,{entry,2097175}}]},{disk_log_test,write_dets,2},{disk_log_test,go,1},{erl_eval
,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}

** exited: {badarg,[{dets,insert,[mydets,{2097175,{entry,2097175}}]},
                    {disk_log_test,write_dets,2},
                    {disk_log_test,go,1},
                    {erl_eval,do_apply,5},
                    {shell,exprs,6},
                    {shell,eval_loop,3}]} **



...and on R12B on gentoo linux (amd64) I get:


inserting 2070000
inserting 2080000
inserting 2090000
** exception error: bad argument
     in function  dets:insert/2
        called as dets:insert(mydets,{2097175,{entry,2097175}})
     in call from disk_log_test:write_dets/2
     in call from disk_log_test:go/1


Thanks,
Dan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080205/aa3fd43e/attachment.html>


More information about the erlang-questions mailing list