Hi Tim,<br><br>Thanks for your answers!<br><br>My original question on the links &amp; supervisors came from my need to know that when my mystery error (cause still unknown but more than likely caused by myself) occurred I got some type of exit or notification so that i could do something about it. I&#39;ve built a wrapper around it now that monitors the connection &amp; channel so can happily forget about meddling with the supervision tree :-)<br>
<br>While doing this I&#39;ve built up more understanding of the library and added the confirmation &amp; retry handling to my wrapper relatively easily. So I just want to say good work on rabbitmq-erlang-client guys!<br>
<br>//TTom.<br><br><br><div class="gmail_quote">On Tue, Oct 16, 2012 at 12:57 PM, Tim Watson <span dir="ltr">&lt;<a href="mailto:tim@rabbitmq.com" target="_blank">tim@rabbitmq.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi!<br>
<div class="im"><br>
On 15 Oct 2012, at 16:07, tom kelly wrote:<br>
<br>
&gt; Hi List,<br>
&gt; New user here, debugging some code I inherited so apologies if my questions below are irrelevant.<br>
&gt;<br>
&gt; I&#39;m investigating an amqp crash that I&#39;ve seen in my logs a few times and after a code review of the amqp component I&#39;m a bit concerned that my connections may be dying &amp; silently failing when this crash occurs.<br>

&gt;<br>
<br>
</div>Ok, let&#39;s look at that then.<br>
<div class="im"><br>
&gt; I&#39;m using an older version that unlinked from the process that called &quot;start_link&quot;, anyone know why that was? I&#39;m publishing through this channel by calling amqp_channel:cast, so now I&#39;m worried that if the connection &amp; channel were closed down everything that I thought I was publishing after this error just silently failed. And because of the unlink there&#39;s no way the application would have known.<br>

&gt;<br>
<br>
</div>I&#39;m really no too sure about this unlink business, but if you could clarify where that was happening then I can probably look through the hg logs to try and figure out what was going on there.<br>
<div class="im"><br>
&gt; I plan upgrading to the latest version but I&#39;m not sure that it has all the features to help solve this problem. I see that the unlink is gone and the supervision policy is still:{one_for_all, 0, 1} So I guess this means I have to trap exits and I have responsibility for reopening the connection &amp; channel if it dies?<br>

<br>
</div>My reading of the supervision hierarchy is thus:<br>
<br>
The application has a top level simple_one_for_one supervisor for all connections, which handles the amqp_connection_sup. This just ensures that each connection can actually be started and they connection_sup is temporary, so no restarts will ever take place. This is presumably what you&#39;d expect, as we&#39;re not trying to second guess how long your connections need to live for.<br>

<br>
The actual connection consists of a few processes - the gen_connection, connection_type_sup and channel_sup_sup. This is a one_for_all supervisor and the actual gen_connection process is an &#39;intrinsic&#39; worker, so a non-normal exit will kill the supervisor (and sibling processes), but a normal exit will take everyone else down cleanly.<br>

<br>
Now the channel_sup_sup starts a temporary worker (amqp_channel_sup) and that starts an intrinsic worker. �So all in all, it looks to me as if the connection and channel will be properly re-established if a non-normal exit occurs.<br>

<div class="im"><br>
&gt; But before I restart it, what happens to any attempts to publish messages? I see there&#39;s new confirmation functionality that sounds like it might do what&#39;s required but from my reading it seems that if amqp_channel is shut down after a crash on the connection then all the confirm info is discarded. Is there no way to keep this process alive and try to re-open the connection immediately on failure?<br>

&gt;<br>
<br>
</div>I&#39;m not really sure what you&#39;re asking here, but my reading of the client is that if you&#39;re expecting a confirm and you&#39;ve not seen it, then you can/should assume the message wasn&#39;t accepted by the broker. If you&#39;re asking about tracking the confirms between channel instances, then yes, you&#39;ll need to do that yourself, using whatever mechanism suits your design (shared/stable storage, stateful parent process, etc).<br>

<div class="im"><br>
&gt; I&#39;m just about to plug in the new version and play with the confirmations but any explanations of the current design might help enormously,<br>
&gt; Thanks,<br>
&gt; //TTom.<br>
<br>
<br>
</div>Well I hope my comments have made it a bit clearly and not worse! Please *do* feel free to come back with any questions, or to clear up anything I&#39;ve not explained properly.<br>
<br>
Cheers,<br>
Tim<br>
<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br>