<div dir="ltr">Yes, I used heartbeats with low value, the stack trace for that thread was in my first post, it is blocked on the same write action:<br><div><div class="gmail_extra"><br>"pool-2-thread-1" prio=10 tid=0xac167000 nid=0x2c60 waiting for monitor entry [0xac77d000]
<br> java.lang.Thread.State: BLOCKED (on object monitor)
<br> at java.io.BufferedOutputStream.write(BufferedOutputStream.java:94)
<br> - waiting to lock <0xb4532608> (a java.io.BufferedOutputStream)
<br> at java.io.DataOutputStream.writeByte(DataOutputStream.java:153)
<br> at com.rabbitmq.client.impl.Frame.writeTo(Frame.java:189)
<br> at com.rabbitmq.client.impl.SocketFrameHandler.writeFrame(SocketFrameHandler.java:137)
<br> - locked <0xb45325f0> (a java.io.DataOutputStream)
<br> at com.rabbitmq.client.impl.HeartbeatSender$HeartbeatRunnable.run(HeartbeatSender.java:133)
<br> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
<br><br></div><div class="gmail_extra">I understand that connection can be easily used from different threads (and we actually use it that way) but there should be possibility to close connection in such blocked socket.write operation. As I mentioned ActiveMQ has such setting, there was the same socketWrite0 blocking call and they have a solution (it's open source so could be checked if it is suitable for RabbitMQ).<br>
<br></div><div class="gmail_extra">For me the client should have possibility to set such timeout or at least have some workaround - I don't see any now.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">
Oleg<br></div><div class="gmail_extra"><br><div class="gmail_quote">2013/10/8 Michael Klishin [via RabbitMQ] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=30322&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span><br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
        On oct 8, 2013, at 1:49 p.m., Oleg Lyalikov <<a href="http://user/SendEmail.jtp?type=node&node=30321&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>> wrote:
<br><br>> So for me it looks like the RabbitMQ client library should provide possibility to set such write timeout - maybe using the same Heartbeat thread (for now this thread is blocked on "writeFrame" method like all other threads waiting freeing the lock on outputStream object).
<br>>
<br>> By the way I still cannot imagine any workaround for this issue but it's really critical for us. Do you think there are some?
<br><br></div><div class="im">Have you tried using heartbeats with a low value (say, single digit seconds)? It was created
<br>exactly for the case when a peer goes away and TCP retransmission covers the fact.
<br><br>RabbitMQ Java client pretty much has to synchronize writes to the socket. You can share connection
<br>between threads w/o realizing so, e.g. by publishing from a consumer callback such
<br>as handleDelivery.
<br><br></div><div class="im">MK
<br><br><br><br><br>_______________________________________________
<br>rabbitmq-discuss mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=30321&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" rel="nofollow" link="external" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br><div><br><img src="http://images/icon_attachment.gif"> <b>signature.asc</b> (506 bytes) <a href="http://rabbitmq.1065348.n5.nabble.com/attachment/30321/0/signature.asc" rel="nofollow" link="external" target="_blank">Download Attachment</a></div>
        
        
        
        <br>
        <br>
        <hr color="#cccccc" noshade size="1">
        </div><div style="color:rgb(68,68,68);font:12px tahoma,geneva,helvetica,arial,sans-serif"><div class="im">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                </div><a href="http://rabbitmq.1065348.n5.nabble.com/Long-timeout-if-server-host-becomes-unreachable-tp30275p30321.html" target="_blank" rel="nofollow" link="external">http://rabbitmq.1065348.n5.nabble.com/Long-timeout-if-server-host-becomes-unreachable-tp30275p30321.html</a>
        </div><div class=""><div class="h5">
        <div style="color:rgb(102,102,102);font:11px/1.5em tahoma,geneva,helvetica,arial,sans-serif;margin-top:0.4em">
                
                To unsubscribe from Long timeout if server host becomes unreachable, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
                <a href="http://rabbitmq.1065348.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></div></div></blockquote></div><br></div></div></div>
        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/Long-timeout-if-server-host-becomes-unreachable-tp30275p30322.html">Re: Long timeout if server host becomes unreachable</a><br/>
Sent from the <a href="http://rabbitmq.1065348.n5.nabble.com/">RabbitMQ mailing list archive</a> at Nabble.com.<br/>