<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 <<a href="mailto:carl.hoerberg@gmail.com">carl.hoerberg@gmail.com</a>> 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>> Hi,
<br>>
<br>> On 7 May 2013, at 04:32, carlhoerberg wrote:
<br>>
<br>> > It looks like the rabbitmq java client doesn't raise an exception as soon as
<br>> > a connection fails, eg. due to network cable disconnection.
<br>> >
<br>> > The following code will continue to run for 2 minutes after the
<br>> > disconnection, and first then raise an exception.
<br>>
<br>>
<br>> 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>>
<br>> On most unices, the relevant bits of `man tcp` are:
<br>>
<br>> "When a network error occurs, TCP tries to resend the packet. If it
<br>> doesn't succeed after some time, either ETIMEDOUT or the last received
<br>> error on this connection is reported."
<br>>
<br>> 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>>
<br>> This problem is, of course, not specific to RabbitMQ.
<br>>
<br>> Cheers,
<br>> Tim
<br>> _______________________________________________
<br>> rabbitmq-discuss mailing list
<br>> [hidden email] (/user/SendEmail.jtp?type=node&node=26470&i=0)
<br>> <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>>
<br>>
<br>> 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>
<br>> To unsubscribe from Java client: closed connection doesn't raise exception immediately, click here (<a href="" target="_top" rel="nofollow" link="external">
<br>> NAML (</a><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" target="_top" rel="nofollow" link="external">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</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>