<html><head></head><body bgcolor="#FFFFFF"><div>No problem - if you need to alleviate this then AMQP heartbeats can ensure client and broker notice a downed peer in a more timely fashion.<br><br>Cheers,</div><div>Tim</div><div><br>On 7 May 2013, at 08:04, carlhoerberg &lt;<a href="mailto:carl.hoerberg@gmail.com">carl.hoerberg@gmail.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>Ok, yes, suspected it had with to do with the underlaying TCP stack, thank you for the detailed explanation! 
<br><br><br><br>On Tuesday 7 May 2013 at 14:58, Tim Watson-6 [via RabbitMQ] wrote:
<br><div class="shrinkable-quote"><br>&gt; Hi, 
<br>&gt; 
<br>&gt; On 7 May 2013, at 04:32, carlhoerberg wrote: 
<br>&gt; 
<br>&gt; &gt; It looks like the rabbitmq java client doesn't raise an exception as soon as 
<br>&gt; &gt; a connection fails, eg. due to network cable disconnection. 
<br>&gt; &gt; 
<br>&gt; &gt; The following code will continue to run for 2 minutes after the 
<br>&gt; &gt; disconnection, and first then raise an exception. 
<br>&gt; 
<br>&gt; 
<br>&gt; That's perfectly normal, for a network driven application. It is not RabbitMQ's client library that wait's to throw an exception, but rather it is the operating system's network stack that takes time to determine that a peer socket is no longer available. This can take many minutes, even when you're connecting via the loopback interface (i.e., localhost) for testing. 
<br>&gt; 
<br>&gt; On most unices, the relevant bits of `man tcp` are: 
<br>&gt; 
<br>&gt; "When a network error occurs, TCP tries to resend the packet. If it 
<br>&gt; doesn't succeed after some time, either ETIMEDOUT or the last received 
<br>&gt; error on this connection is reported." 
<br>&gt; 
<br>&gt; In that second sentence, "after some time" is determined by the OS kernel configured limits, viz tcp_retries1 (defaults to 3 on linux) and tcp_retries2, and the configured retransmission timeout. Of course there are doubtless other parameters that interact with this behaviour. So you're quite lucky because it's a producer application that's trying to send - those time out much faster. For network consumer applications, this problem is quite a tricky on because the default settings on linux for example, mean delays of between 10 and 30 minutes before the OS networking layer "notices" the connection has timed out. 
<br>&gt; 
<br>&gt; This problem is, of course, not specific to RabbitMQ. 
<br>&gt; 
<br>&gt; Cheers, 
<br>&gt; Tim 
<br>&gt; _______________________________________________ 
<br>&gt; rabbitmq-discuss mailing list 
<br>&gt; [hidden email] (/user/SendEmail.jtp?type=node&amp;node=26470&amp;i=0) 
<br>&gt; <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_top" rel="nofollow" link="external">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>&gt; 
<br>&gt; 
<br>&gt; If you reply to this email, your message will be added to the discussion below: <a href="http://rabbitmq.1065348.n5.nabble.com/Java-client-closed-connection-doesn-t-raise-exception-immediately-tp26465p26470.html" target="_top" rel="nofollow" link="external">http://rabbitmq.1065348.n5.nabble.com/Java-client-closed-connection-doesn-t-raise-exception-immediately-tp26465p26470.html</a>&nbsp;
<br>&gt; To unsubscribe from Java client: closed connection doesn't raise exception immediately, click here (<a href="" target="_top" rel="nofollow" link="external">
<br>&gt; NAML (</a><a href="http://rabbitmq.1065348.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" target="_top" rel="nofollow" link="external">http://rabbitmq.1065348.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml</a>) 
</div><br><br><br>

        
        
        
<br><hr align="left" width="300">
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/Java-client-closed-connection-doesn-t-raise-exception-immediately-tp26465p26472.html">Re: Java client: closed connection doesn't raise exception immediately</a><br>
Sent from the <a href="http://rabbitmq.1065348.n5.nabble.com/">RabbitMQ mailing list archive</a> at <a href="http://Nabble.com">Nabble.com</a>.<br></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>rabbitmq-discuss mailing list</span><br><span><a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a></span><br><span><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a></span><br></div></blockquote></body></html>