ets table becomes unusable after a failed insert

Vincent de Phily vincent.dephily@REDACTED
Fri Jul 24 11:30:21 CEST 2009


Hi list,

here's a quick demo:

Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] 
[kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
1> Table = ets:new(foobar, [set, public]).
16397
2> ets:tab2list(Table).
[]
3> ets:insert(Table, {1}).
true
4> ets:insert(Table, {2}).
true
5> ets:tab2list(Table).
[{1},{2}]
6> ets:insert(Table, 3).
** exception error: bad argument
     in function  ets:insert/2
        called as ets:insert(16397,3)
7> ets:insert(Table, {3}).
** exception error: bad argument
     in function  ets:insert/2
        called as ets:insert(16397,{3})
8> ets:tab2list(Table).
** exception error: bad argument
     in function  ets:match_object/2
        called as ets:match_object(16397,'_')
     in call from ets:tab2list/1

The failure at 6> is expected since I didn't insert a tuple. But I expected 7> 
and 8> to work : one failed insert shouldn't make all subsequent operations 
fail. Unless there's some very good argument I'm missing ?

-- 
Vincent de Phily
Mobile Devices
+33 (0) 666 301 306
+33 (0) 142 119 325

Warning
This message (and any associated files) is intended only for the use of its
intended recipient and may contain information that is confidential, subject
to copyright or constitutes a trade secret. If you are not the intended
recipient you are hereby notified that any dissemination, copying or
distribution of this message, or files associated with this message, is
strictly prohibited. If you have received this message in error, please
notify us immediately by replying to the message and deleting it from your
computer. Any views or opinions presented are solely those of the author
vincent.dephily@REDACTED and do not necessarily represent those of 
the
company. Although the company has taken reasonable precautions to ensure no
viruses are present in this email, the company cannot accept responsibility
for any loss or damage arising from the use of this email or attachments.


More information about the erlang-bugs mailing list