[rabbitmq-discuss] Long timeout if server host becomes unreachable

Michael Klishin michael at rabbitmq.com
Tue Oct 8 11:27:23 BST 2013


On oct 8, 2013, at 2:11 p.m., Oleg Lyalikov <oleg.lyalikov at gmail.com> wrote:

> For me the client should have possibility to set such timeout or at least have some workaround - I don't see any now.

Oleg,

I understand your frustration. I will file a bug about this.

It should be possible to getFrameHandler on a connection and close its underlying
socket with SocketFrameHandler#close. It does not write any data and catches
any exceptions that may arise. It also does not use the output stream which is
what SocketFrameHandler#writeFrame synchronizes on.

So try detecting that the peer is gone in your own code (note: this is *the* fundamental
issue here, not that JDK sockets don't have a timeout API) and close the socket.
I cannot tell if that may cause the write method to throw but it's worth trying.

Another relatively unintrusive option I can think of is modifying
SocketFramehandler to use a lock that supports timeouts. This way it would be
easier to detect the issue and instantiate a new connection.

MK



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131008/eddc4ee7/attachment.pgp>


More information about the rabbitmq-discuss mailing list