[erlang-questions] Mnesia read timeout

Rajesh Bhat <>
Fri Dec 10 16:19:55 CET 2010


Thanks. Yes it was gen_server call that timed out. I meant to ask what would cause mnesia:read to take that long. Yes read and update events can be requested from separate processes on the same record. Given that scenario, is it possible the write operation took long time? 

Thanks
-- Rajesh



-----Original Message-----
From:  [mailto:] On Behalf Of Håkan Mattsson
Sent: Friday, December 10, 2010 8:23 AM
To: Rajesh Bhat
Cc: 
Subject: Re: [erlang-questions] Mnesia read timeout

On Fri, Dec 10, 2010 at 2:47 PM, Rajesh Bhat <> 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

______________________________________________

See  http://www.peak6.com/email_disclaimer.php
for terms and conditions related to this email


More information about the erlang-questions mailing list