Hi Tim,<div><br></div><div>I used debug_printf() and things didn&#39;t change.</div><div><br></div><div>But I saw where is the problem. In the stub generated by flounder named &quot;ambf_flounder_bindings.c&quot;, there is a function &quot;ambf_ump_rx_handler()&quot; called in the event_dispatch(). This function has a:</div>
<div><br></div><div><div>    while (true) {</div><div>        // try to retrieve a message from the channel</div></div><div><br></div><div>dispatches one message and then dispatches another without returning. I saw it in the debugger as the ambf_ump_rx_handler() function is only hitting once while delivering the two messages.</div>
<div><br></div><div>So one event in the waitset may carry several messages...</div><div><br></div><div>That means that my code has to change a bit now :)</div><div><br></div><div><br></div><div>zeus.</div><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
<br><div class="gmail_quote">2011/8/17 Tim Harris (RESEARCH) <span dir="ltr">&lt;<a href="mailto:tharris@microsoft.com">tharris@microsoft.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">






<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Hi Zeus,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Two possible things to check:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p><u></u><span style="font-size:11.0pt;font-family:Symbol;color:#1F497D"><span>·<span style="font:7.0pt &quot;Times New Roman&quot;">        
</span></span></span><u></u><span style="font-size:11.0pt;color:#1F497D">Are you using printf or debug_printf for output?  I’d suggest using the latter – it really goes out right away, so you can trust what you see
</span><span style="font-size:11.0pt;font-family:Wingdings;color:#1F497D">J</span><span style="font-size:11.0pt;color:#1F497D"><br>
<br>
<u></u><u></u></span></p>
<p><u></u><span style="font-size:11.0pt;font-family:Symbol;color:#1F497D"><span>·<span style="font:7.0pt &quot;Times New Roman&quot;">        
</span></span></span><u></u><span style="font-size:11.0pt;color:#1F497D">If it possible that the message handler is doing something that is causing a recursive call to event_dispatch?  (Actually, maybe this would be from
 within printf?)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Cheers,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Tim<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> <a href="mailto:zeus@aluzina.org" target="_blank">zeus@aluzina.org</a> [mailto:<a href="mailto:zeus@aluzina.org" target="_blank">zeus@aluzina.org</a>]
<b>On Behalf Of </b>Zeus Gómez Marmolejo<br>
<b>Sent:</b> 17 August 2011 15:31<br>
<b>To:</b> Timothy Roscoe<br>
<b>Cc:</b> <a href="mailto:barrelfish-users@lists.inf.ethz.ch" target="_blank">barrelfish-users@lists.inf.ethz.ch</a>; Tim Harris (RESEARCH)<br>
<b>Subject:</b> Re: [Barrelfish-users] Messages<u></u><u></u></span></p><div><div></div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I discovered another surprising thing. I&#39;m calling the function messages_wait_and_handle_next() to wait and dispatch one message. Which in turn calls to event_dispatch(). According to the info I get on screen, sometimes it handles two messages
 before returning. This is strange.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I was inspecting the code and it&#39;s calling to get_next_event() which is supposed to handle only one event from the waitset. I don&#39;t understand this behavior, is this possible?<u></u><u></u></p>

</div>
<div>
<p class="MsoNormal">zeus.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">El 17 de agosto de 2011 14:48, Zeus Gómez Marmolejo &lt;<a href="mailto:zeus.gomez@bsc.es" target="_blank">zeus.gomez@bsc.es</a>&gt; escribió:<u></u><u></u></p>
<p class="MsoNormal">Ok, I don&#39;t get any failures when sending messages, as I&#39;m always checking with can_send(). Otherwise, I call the event_dispatch().<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">But now I&#39;m sure that messages get reordered somehow. It&#39;s difficult to send the code as it&#39;s quite involved, but I filled the code with some printf. I&#39;m using own implemented barriers using the barrelfish message passing and I see the
 message handler that is in the barrier dispatching messages that were sent after the barrier reply. Then suddenly the message reply for the barrier arrives ... how can it be?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I don&#39;t know how the stub is working but is it possible that is sending a retry of a message after the following message has been sent?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">zeus.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">El 13 de agosto de 2011 17:49, Timothy Roscoe &lt;<a href="mailto:troscoe@inf.ethz.ch" target="_blank">troscoe@inf.ethz.ch</a>&gt; escribió:<u></u><u></u></p>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><br>
Well, messages should never be lost or reordered on a UMP channel, but<br>
both sending and receiving messages can temporarily fail in a variety<br>
of ways (we push retries due to full channels, etc. back to the<br>
sender).<br>
<br>
This means that a single-threaded sender and receiver can deadlock if<br>
they&#39;re not careful about handling things like send failures due to a<br>
full channel, or the need to send acks back from the receiver.<br>
<br>
The stubs try to hide most of the functionality required for this,<br>
except for the fact that any send or recv can fail (as with Unix NBIO<br>
and select/poll).<br>
<br>
That said, you probably already know most of this :-)<br>
<br>
And, of course, there are probably bugs.<br>
<br>
 -- Mothy<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><br>
At Sat, 13 Aug 2011 15:08:27 +0200, Zeus Gómez Marmolejo &lt;<a href="mailto:zeus.gomez@bsc.es" target="_blank">zeus.gomez@bsc.es</a>&gt; wrote:<br>
&gt; I&#39;m trying to simplify the code (I&#39;m using all gasnet and the library I<br>
&gt; made), but whenever I get it simpler it turns out that it&#39;s working...<br>
&gt;<br>
&gt; So I have to figure out where the problem is.<br>
&gt;<br>
&gt;<br>
&gt; El 12 de agosto de 2011 11:43, Tim Harris (RESEARCH)<br>
&gt; &lt;<a href="mailto:tharris@microsoft.com" target="_blank">tharris@microsoft.com</a>&gt;escribió:<br>
&gt;<br>
&gt; &gt;  Could you post some code examples?****<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; Cheers,****<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; Tim****<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; *From:* Zeus Gómez Marmolejo [mailto:<a href="mailto:zeus.gomez@bsc.es" target="_blank">zeus.gomez@bsc.es</a>]<br>
&gt; &gt; *Sent:* 12 August 2011 10:42<br>
&gt; &gt; *To:* <a href="mailto:barrelfish-users@lists.inf.ethz.ch" target="_blank">barrelfish-users@lists.inf.ethz.ch</a><br>
&gt; &gt; *Subject:* [Barrelfish-users] Messages****<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; Hi,****<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; I&#39;m developing a benchmark for message passing in Barrelfish, but I don&#39;t<br>
&gt; &gt; get it working properly. I experience some random errors. ****<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; The application is single threaded and it&#39;s using the flounder stubs to<br>
&gt; &gt; send messages via the UMP backend. Some of the messages get lost. Is it<br>
&gt; &gt; possible that they arrive in different order that they were sent? I&#39;m not<br>
&gt; &gt; sure how to debug it****<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; ** **<br>
&gt; &gt;<br>
&gt; &gt; Thanks for your help!<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; Zeus Gómez Marmolejo<br>
&gt; &gt; Barcelona Supercomputing Center<br>
&gt; &gt; PhD student<br>
&gt; &gt; <a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br>
&gt; &gt;<br>
&gt; &gt; ****<br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Zeus Gómez Marmolejo<br>
&gt; Barcelona Supercomputing Center<br>
&gt; PhD student<br>
&gt; <a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br>
&gt;<u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Zeus Gómez Marmolejo<br>
Barcelona Supercomputing Center<br>
PhD student<br>
<a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br>
<br>
<u></u><u></u></p>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">-- <br>
Zeus Gómez Marmolejo<br>
Barcelona Supercomputing Center<br>
PhD student<br>
<a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br>
<br>
<u></u><u></u></p>
</div>
</div></div></div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br>Zeus Gómez Marmolejo<br>Barcelona Supercomputing Center<br>PhD student<br><a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br><br><br>
</div>