I&#39;ve built a behavior in erlang to subscribe to a given topic exchange and farm out message handling.  I&#39;m using the rabbitmq amqp_client library for erlang and when I put the system under heavy load I get, on occasion, the following error:<div>
<br></div><div><div>=ERROR REPORT==== 29-Jun-2011::18:02:18 ===</div><div>** Generic server &lt;0.1117.0&gt; terminating </div><div>** Last message in was {&#39;$gen_cast&#39;,</div><div>                           {method,</div>
<div>                               {&#39;channel.close&#39;,406,</div><div>                                   &lt;&lt;&quot;PRECONDITION_FAILED - unknown delivery tag 856&quot;&gt;&gt;,</div><div>                                   60,80},</div>
<div>                               none}}</div><div>** When Server state == {state,1,&lt;0.1116.0&gt;,network,</div><div>                               {[],[]},</div><div>                               {[],[]},</div><div>
                               {dict,0,16,16,8,80,48,</div><div>                                     {[],[],[],[],[],[],[],[],[],[],[],[],[],</div><div>                                      [],[],[]},</div><div>                                     {{[],[],[],[],[],[],[],[],[],[],[],[],[],</div>
<div>                                       [],[],[]}}},</div><div>                               false,&lt;0.1118.0&gt;,none,none,0,true,none,</div><div>                               {dict,1,16,16,8,80,48,</div><div>                                     {[],[],[],[],[],[],[],[],[],[],[],[],[],</div>
<div>                                      [],[],[]},</div><div>                                     {{[[&lt;&lt;&quot;amq.ctag-1sViVE9Y/wIKyAliWqjeCA==&quot;&gt;&gt;|</div><div>                                         etl_dispatch]],</div>
<div>                                       [],[],[],[],[],[],[],[],[],[],[],[],[],</div><div>                                       [],[]}}},</div><div>                               none,#Fun&lt;amqp_channel_sup.1.53915388&gt;}</div>
<div>** Reason for termination == </div><div>** {server_initiated_close,406,</div><div>                           &lt;&lt;&quot;PRECONDITION_FAILED - unknown delivery tag 856&quot;&gt;&gt;}</div></div><div><br></div><div>
The server receive loop where the ack happens looks like this:</div><div>receive</div><div>...</div><div><div>{#&#39;basic.deliver&#39;{delivery_tag = Tag, routing_key = RoutingKey}, #amqp_msg{payload = Payload}} -&gt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>    amqp_channel:cast(get(amqp_channel_pid), #&#39;basic.ack&#39;{delivery_tag = Tag}),</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>    spawn_and_queue(spawn_handle_message, Module, RoutingKey, Payload),</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>    loop(Module);</div></div><div>...</div><div>end</div><div><br></div><div>The amqp_client_sup can&#39;t seem to bring back the the client either and dies from the retry intensity being reached.  I&#39;ve done a hefty amount of googling and can&#39;t seem to find where things could be going wrong.  Before jumping into the amqp_client code I thought I&#39;d ask the mailing list if they have any ideas.  The only thing I can think is that there is a race condition within the client library.  I will be double checking my code to be sure it isn&#39;t sending the ack twice, but given the simplicity of the ack the only way it could is if it receives the same message (with identical delivery tag) from the amqp_client library twice.</div>
<div><br></div><div>Thanks,</div><div>-Max</div>