Bug in dets module

Crystal Din crystaldin49@REDACTED
Sat Jun 13 16:11:31 CEST 2009


Hi,

Version: Erlang/OTP R13B. Bug in dets module.

If we put a delay between calling function dets:insert/2 and
dets:insert_new/2, we get different answers depending on the delay.


-----------------dets_test.erl-----------------------
weird(Delay) ->
    dets:open_file(tabName, [{type, duplicate_bag}]),
    dets:delete_all_objects(tabName),
    dets:insert(tabName, {3,0}),
    receive after Delay -> ok end,
    dets:insert_new(tabName, [{3,0},{3,0}]),
    X = dets:lookup(tabName, 3),
    dets:close(tabName),
    X.

----------------------testing-----------------------
1> dets_test:weird(2500).
[{3,0},{3,0}]
2> dets_test:weird(2750).
[{3,0},{3,0}]
3> dets_test:weird(2900).
[{3,0},{3,0}]
4> dets_test:weird(2950).
[{3,0},{3,0}]
5> dets_test:weird(2999).
[{3,0},{3,0}]
6> dets_test:weird(3000).
[{3,0}]


This error is caused not only according to the delay between executing
dets:insert/2 and dets:insert_new/2. The same thing happens if we use
dets:insert_new/2 instead of dets:insert/2.


/Crystal Din


More information about the erlang-bugs mailing list