<p dir="ltr">Why not try to send / receive { A, B } instead of A, B</p>
<p dir="ltr">?</p>
<div class="gmail_quote">On 17 Nov 2014 22:38, <<a href="mailto:arif@riseup.net">arif@riseup.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I have the simplest of applications that consists of just the skeleton gen_server, registered locally as "server", with one callback implemented:<br>
<br>
handle_info({From, A, B}, State) -><br>
From ! {self(), A + B},<br>
{noreply, State};<br>
<br>
i.e. a simple adder<br>
<br>
The supervisor is the skeleton one_for_one supervisor. The application, app, the skeleton application.<br>
<br>
Here is what I do:<br>
<br>
7> application:start(app).<br>
ok<br>
8> server ! {self(), 1, 2}.<br>
{<0.32.0>,1,2}<br>
9> receive X -> X end.<br>
{<0.62.0>,3}<br>
10> server ! {self(), a, b}.<br>
<br>
=ERROR REPORT==== 17-Nov-2014::22:18:42 ===<br>
** Generic server server terminating<br>
** Last message in was {<0.32.0>,a,b}<br>
** When Server state == {state}<br>
** Reason for termination ==<br>
** {badarith,[{server,handle_<u></u>info,2,[{file,"server.erl"},{<u></u>line,98}]},<br>
{gen_server,handle_msg,5,[{<u></u>file,"gen_server.erl"},{line,<u></u>599}]},<br>
{proc_lib,init_p_do_apply,3,<br>
[{file,"proc_lib.erl"},{line,<u></u>239}]}]}<br>
{<0.32.0>,a,b}<br>
11> server ! {self(), 3, 4}.<br>
{<0.32.0>,3,4}<br>
12> receive X -> X end.<br>
<br>
and here the shell blocks.<br>
The message ({<0.67.0>,7}) is in the shell's mailbox alright. I can see it by running observer.<br>
<br>
If, instead of receive X -> X end, I do a flush(), the message _is_ flushed.<br>
<br>
It is reproducible on R 17, R15B01, on linux and on windows.<br>
<br>
What am I doing wrong?<br>
<br>
Thanks and best regards<br>
Arif<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</blockquote></div>