<br><br><div class="gmail_quote">On Fri, Mar 27, 2009 at 4:00 PM, tsuraan <span dir="ltr"><<a href="mailto:tsuraan@gmail.com">tsuraan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
According to the documentation, a gen_server call function may fail if<br>
the process in question exits before the call returns. What exactly<br>
does fail mean in this context? Does gen_server:call raise an<br>
exception? If so, is the format of that exception documented<br>
anywhere?</blockquote><div><br>I assume you mean the sentence in the gen_server ref man that states, "The call may fail for several reasons, including timeout and
the called gen_server dying before or during the call.
"<br><br>The answer seems to be that if the gen_server dies before the call is complete, the calling function receives an exit:<br> <br><span style="font-family: courier new,monospace;">{'EXIT', {Reason, {gen_server, call, [Module, Function]}}}</span><br>
<br>I played around with some throwaway code to get the above results. It's attached if you're interested.<br><br><span style="font-family: courier new,monospace;">(ed17404@ender)26> gscaller:run(). </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[gscaller:<0.133.0>:{1238,457700,76877}] Calling slow_call(). </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><0.134.0> </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[gsfail:<0.131.0>:{1238,457700,76951}] Received slow call, starting wait. </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[gscaller:<0.134.0>:{1238,457701,78177}] Killing <0.131.0>. </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[gscaller:<0.133.0>:{1238,457701,78274}] slow_call() returned, result = {'EXIT', </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> {killed, </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> {gen_server, </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> call, </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> [gsfail, </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> slow_call]}}} </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">** exception error: killed </span><br style="font-family: courier new,monospace;"><br><br>Ed<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
</blockquote></div><br>