[erlang-questions] Mnesia read timeout
Håkan Mattsson
hm@REDACTED
Fri Dec 10 15:22:42 CET 2010
On Fri, Dec 10, 2010 at 2:47 PM, Rajesh Bhat <rbhat@REDACTED> wrote:
> Hi,
>
> I ran into an issue where Mnesia read operation timed out during a test. Following code is called from a gen_server call with a time out of 30 seconds. During test, the call timed out one time. It has not happened since. However would like to understand under what scenario Mnesia read can time out. Reviewing the system report for any unusual activity (i/o, memory etc). has not yielded any clues
>
> Following is the code snippet called from gen_server
>
> get_state(Key) ->
> F = fun() ->
> mnesia:read({key_val_tab, Key})
> end,
> case mnesia:transaction(F) of
> {atomic, [S]} ->
> S;
> _Else ->
> not_found
> end.
>
> Any thoughts?
I suppose that it was your own gen_server call that timed out, as
mnesia:read/1 never times out. It look likes you have encountered a
long lasting lock conflict somewhere in your code. Perhaps you have
another transaction that first grabbed a write lock on the same record
and then performed a gen_server call that did not return. If you have
side effect free transactions, you should never encounter lock
conflicts that lasts for such a long time.
/Håkan
More information about the erlang-questions
mailing list