[erlang-questions] Reading from private ets tables?

Attila Rajmund Nohl attila.r.nohl@REDACTED
Wed Oct 19 11:19:03 CEST 2011


Hello!

Thanks, the get_held_locks() was useful. It looks like two nodes have
different ideas about which process has write lock to the schema
table:

(netsim_guinode__4071@REDACTED)50> mnesia_locker:get_held_locks().

[{{schema,'______WHOLETABLE_____'},write,{tid,3,<0.382.0>}}]

(netsim_superserver@REDACTED)59> mnesia_locker:get_held_locks().
[{{schema,'______WHOLETABLE_____'},write,{tid,565762,<21481.17181.0>}}]

It all happens when the first node tries to add itself to mnesia:
{ok, _Nodes} = mnesia:change_config(extra_db_nodes, [SuperNode]).

Bad luck.

2011/10/18 Ulf Wiger <ulf.wiger@REDACTED>:
>
> No, you can't read private ets tables (owned by some other process).
>
> However, in this particular case, mnesia does offer some functions that might be of help.
>
> mnesia:info() prints quite a lot of information, including info about held locks.
>
> Another function: mnesia_locker:get_held_locks():
>
> 3> mnesia_locker:get_held_locks().
> []
> 4> mnesia:create_table(t, []).
> {atomic,ok}
> 5> spawn(fun() -> mnesia:transaction(fun() -> mnesia:write({t,1,a}), timer:sleep(30000) end) end).
> <0.55.0>
> 6> mnesia_locker:get_held_locks().
> [{{t,1},write,{tid,4,<0.55.0>}}]
> ...
> 7> mnesia_locker:get_held_locks().
> []
>
> Finally, mnesia_lib:dist_coredump() is a big hammer, when all else fails.
>
> BR,
> Ulf W
>
> On 18 Oct 2011, at 11:39, Attila Rajmund Nohl wrote:
>
>> Hello!
>>
>> Is there a way to read data from private ets tables? I have to debug
>> mnesia, but the interesting tables (e.g. mnesia_held_locks) are
>> private, so I can't find whose locks are deadlocking.
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
> Ulf Wiger, CTO, Erlang Solutions, Ltd.
> http://erlang-solutions.com
>
>
>
>



More information about the erlang-questions mailing list