<div dir="ltr">Following is my code to use mnesia and I get {aborted,nomore} sometimes.<div>What would be the reason?</div><div><br></div><div>







<p class=""><span class="">up(</span>Name<span class="">, </span>Module<span class="">) </span><span class="">-></span></p>
<p class=""><span class=""></span><span class="">  Pid</span> = self(),</p>
<p class=""><span class=""></span><span class="">  Route</span> = #<span class="">?MODULE</span>{name=<span class="">Name</span>, addr=<span class="">Pid</span>, module=<span class="">Module</span>},</p>
<p class=""><span class=""></span><span class="">  F</span> = <span class="">fun</span>() <span class="">-></span></p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class="">    case</span> mnesia:wread({<span class="">?MODULE</span>, <span class="">Name</span>}) <span class="">of</span></p>

<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>      [#<span class="">?MODULE</span>{name=<span class="">Name</span>, addr=<span class="">Pid</span>, module=<span class="">Module</span>}] <span class="">-></span></p>

<p class="">        ok;<br></p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>      [#<span class="">?MODULE</span>{name=<span class="">Name</span>, addr=undefined, module=<span class="">Module</span>}] <span class="">-></span></p>

<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>        mnesia:write(<span class="">Route</span>);</p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>      [#<span class="">?MODULE</span>{name=<span class="">Name</span>, addr=<span class="">Addr</span>, module=<span class="">Module</span>}] <span class="">-></span></p>

<p class="">        exit(<span class="">Addr</span>, kill),<br></p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>        mnesia:write(<span class="">Route</span>);</p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>      [#<span class="">?MODULE</span>{name=<span class="">Name</span>}] <span class="">-></span></p>

<p class="">        {error, collision};<br></p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>      [] <span class="">-></span></p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>        mnesia:write(<span class="">Route</span>);</p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class="">      Error</span> <span class="">-></span></p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class=""></span>        {error, <span class="">Error</span>}</p>
<p class=""><span class=""></span><span class=""></span><span class=""></span><span class=""></span><span class="">    end</span></p>
<p class=""><span class=""></span><span class=""></span><span class="">  end</span>,</p>
<p class=""><span class=""></span><span class="">  case</span> mnesia:transaction(<span class="">F</span>, <span class="">?MNESIA_TRANSACTION</span>) <span class="">of</span></p>
<p class=""><span class=""></span><span class=""></span>    {atomic, <span class="">Result</span>} <span class="">-></span> <span class="">Result</span>;</p>
<p class=""><span class=""><span class=""></span><span class=""></span></span>    Aborted<span class=""> </span><span class="">-></span><span class=""> </span>Aborted</p>
<p class=""><span class=""></span>  end<span class="">.</span></p><div><div><br></div>-- <br>Park, Sungjin<div>-------------------------------------------------------------------------------------------------------------------</div>
<div>Peculiar travel suggestions are dancing lessons from god.</div><div>  -- The Books of Bokonon</div><div>-------------------------------------------------------------------------------------------------------------------</div>

</div></div></div>