[erlang-questions] Possible bug after ets:insert exception

Trevor Woollacott [ MTN - Innovation Centre ] <>
Tue Aug 19 16:17:45 CEST 2008


Hi

It's not a bug. The shell crashed when you tried to insert the atom (due
to the uncaught exception). This is because you started the ETS table
from the shell, so the ETS table is linked to that particular shell
process.

Try:
1> self().
2> ets:new(testtable,[set,named_table,private]).
3> ets:insert(testtable, bar).
4> self().

You will notice that the shell's pid's are different at (1) and (4).

If you put a "catch" in front of the ets:insert at (3) it will catch the
exception and the shell will not crash.

Regards,
Trevor

-----Original Message-----
From: 
[mailto:] On Behalf Of Colm Dougan
Sent: Tuesday, 19 August 2008 03:34 PM
To: 
Subject: [erlang-questions] Possible bug after ets:insert exception

Hi,

I'm running 12B-3.  Below is a console session.  Everything worked as
expected until "4>" where I unintentionally provided an atom in my
insert and I get a bad arg.  Again that was expected.  What I didn't
expect, however, was that from then on the ets table seemed to be in a
bad state and couldn't be queried.  I realise this is an edge case.
Is this a bug?

Colm

Eshell V5.6.3  (abort with ^G)
1> ets:new(testtable,[set,named_table,private]).
testtable
2> ets:insert(testtable, [{foo, 10}]).
true
3> ets:tab2list(testtable).
[{foo,10}]
4> ets:insert(testtable, bar).
** exception error: bad argument
     in function  ets:insert/2
        called as ets:insert(testtable,bar)
5> ets:tab2list(testtable).
** exception error: bad argument
     in function  ets:match_object/2
        called as ets:match_object(testtable,'_')
     in call from ets:tab2list/1
_______________________________________________
erlang-questions mailing list

http://www.erlang.org/mailman/listinfo/erlang-questions

NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/default.aspx?pid=34411 



More information about the erlang-questions mailing list