<div dir="ltr">Michael,<div><br></div><div>Actually I am opening and closing connections quite a lot (once every ~3 RPC requests on average). Is that bad and I&#39;m supposed to pool them?</div><div><br></div><div>The client code is (split into multiple methods actually, but roughly):</div>
<div><br></div><div>            factory = new ConnectionFactory();<br></div><div><div>           connection = factory.newConnection();</div><div><span class="" style="white-space:pre">        </span>    channel = connection.createChannel();</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>    Map&lt;String, Object&gt; arguments = new HashMap&lt;String, Object&gt;();</div><div><span class="" style="white-space:pre">        </span>    arguments.put(&quot;x-expires&quot;, 10*60*1000); // 10 min</div>
<div><span class="" style="white-space:pre">            r</span>eplyQueueName = channel.queueDeclare(&quot;&quot;, false, true, true, arguments).getQueue();<span class="" style="white-space:pre">        </span>    </div><div><span class="" style="white-space:pre">        </span>    </div>
<div><span class="" style="white-space:pre">        </span>    consumer = new QueueingConsumer(channel);</div><div><span class="" style="white-space:pre">        </span>    channel.basicConsume(replyQueueName, true, consumer);</div></div>
<div><br></div><div><div>            String response = null;</div><div><span class="" style="white-space:pre">        </span>    String corrId = UUID.randomUUID().toString();</div><div><br></div><div><span class="" style="white-space:pre">        </span>    BasicProperties props = new BasicProperties.Builder()</div>
<div><span class="" style="white-space:pre">        </span>    <span class="" style="white-space:pre">        </span>.correlationId(corrId) </div><div><span class="" style="white-space:pre">        </span>    <span class="" style="white-space:pre">        </span>.expiration(DEFAULT_TIMEOUT + &quot;&quot;) </div>
<div><span class="" style="white-space:pre">        </span>    <span class="" style="white-space:pre">        </span>.replyTo(replyQueueName)</div><div><span class="" style="white-space:pre">        </span>    <span class="" style="white-space:pre">        </span>.build();</div>
<div><span class="" style="white-space:pre">        </span>    </div><div><span class="" style="white-space:pre">        </span>    channel.basicPublish(&quot;&quot;, queueName, props, message.getBytes()); </div></div><div><br></div><div>
                while (true) {</div><div><span class="" style="white-space:pre">        </span>        QueueingConsumer.Delivery delivery = null;</div><div><span class="" style="white-space:pre">                        </span>try {</div><div><span class="" style="white-space:pre">                                </span>delivery = consumer.nextDelivery(100);</div>
<div><span class="" style="white-space:pre">                        </span>} catch (InterruptedException e) {}</div><div><span class="" style="white-space:pre">                        </span></div><div><span class="" style="white-space:pre">                        </span>if (delivery == null) {</div>
<div><span style="white-space:pre">                               </span>continue;<br></div><div><span class="" style="white-space:pre">                        </span>}<span class="" style="white-space:pre">                                </span><br></div><div><span class="" style="white-space:pre">                        </span></div>
<div><span class="" style="white-space:pre">        </span>        if (delivery.getProperties().getCorrelationId().equals(corrId)) {</div><div><span class="" style="white-space:pre">        </span>            response = new String(delivery.getBody());<span class="" style="white-space:pre">        </span>                            </div>
<div><span class="" style="white-space:pre">        </span>            break;</div><div><span class="" style="white-space:pre">        </span>        } else {</div><div><span class="" style="white-space:pre">        </span>        <span class="" style="white-space:pre">        </span>continue;<br>
</div><div><span class="" style="white-space:pre">        </span>        }</div><div><span class="" style="white-space:pre">        </span>    }</div><div><br></div><div><div><span class="" style="white-space:pre">        </span>if (connection != null)</div>
<div>connection.abort(); // .close seemed to hang at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:492) -&gt; com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:50)</div></div><div><br></div><div><br></div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 8, 2013 at 9:11 PM, Michael Klishin <span dir="ltr">&lt;<a href="mailto:michael@rabbitmq.com" target="_blank">michael@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">John M.:<br>
<br>
&gt; I&#39;ve reviewed the Rabbit logs and the only kind of errors I find there are:<br>
&gt;<br>
&gt;     =ERROR REPORT==== 6-Sep-2013::21:36:59 ===<br>
&gt;     closing AMQP connection &lt;0.3105.1297&gt; (<a href="http://10.118.69.132:42582" target="_blank">10.118.69.132:42582</a> -&gt; <a href="http://10.12.111.134:5672" target="_blank">10.12.111.134:5672</a>):<br>
&gt;     {handshake_timeout,frame_header}<br>
<br>
John,<br>
<br>
Can you post a snippet of your code that demonstrates what operations lead<br>
[presumably] to this error? Is it possible that you are opening and closing connections<br>
constantly or only creating and deleting reply queues?<br>
<span class="HOEnZb"><font color="#888888"><br>
MK<br>
<br>
<br>
<br>
</font></span></blockquote></div><br></div>