[erlang-questions] {aborted,nomore} from mnesia

Håkan Mattsson hm@REDACTED
Wed Jul 17 12:36:44 CEST 2013


When Mnesia detects that your transaction have run into a potential
deadlock, it may restart your transaction. By default there is no
restart limit. But you have explicitly configured Mnesia to only allow
a certain number of restarts. When that limit is reached, the
transaction will be aborted with 'nomore' as reason.

/Håkan

On Wed, Jul 17, 2013 at 11:06 AM, Park, Sungjin <jinni.park@REDACTED> wrote:
> Following is my code to use mnesia and I get {aborted,nomore} sometimes.
> What would be the reason?
>
> up(Name, Module) ->
>
>   Pid = self(),
>
>   Route = #?MODULE{name=Name, addr=Pid, module=Module},
>
>   F = fun() ->
>
>     case mnesia:wread({?MODULE, Name}) of
>
>       [#?MODULE{name=Name, addr=Pid, module=Module}] ->
>
>         ok;
>
>       [#?MODULE{name=Name, addr=undefined, module=Module}] ->
>
>         mnesia:write(Route);
>
>       [#?MODULE{name=Name, addr=Addr, module=Module}] ->
>
>         exit(Addr, kill),
>
>         mnesia:write(Route);
>
>       [#?MODULE{name=Name}] ->
>
>         {error, collision};
>
>       [] ->
>
>         mnesia:write(Route);
>
>       Error ->
>
>         {error, Error}
>
>     end
>
>   end,
>
>   case mnesia:transaction(F, ?MNESIA_TRANSACTION) of
>
>     {atomic, Result} -> Result;
>
>     Aborted -> Aborted
>
>   end.
>
>
> --
> Park, Sungjin
> -------------------------------------------------------------------------------------------------------------------
> Peculiar travel suggestions are dancing lessons from god.
>   -- The Books of Bokonon
> -------------------------------------------------------------------------------------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list