[rabbitmq-discuss] Clean up stale connections without restarting?

Matthias Radestock matthias at rabbitmq.com
Fri Sep 10 12:15:48 BST 2010


Nick,

On 08/09/10 19:40, Nick wrote:
> Some of the clients connected to it quit uncleanly, and seem to have
> caused RabbitMQ to leave the connection open.  When the client comes
> back online, I now have two connections listed (via rabbitmqctl) to
> that IP address but on different ports.  I'm worried that I'm losing
> jobs to these zombie connections.  How can I clear them out without
> restarting RabbitMQ entirely?

The connections should clear eventually, though it may take quite a 
while depending on your kernel's settings.

Do the connections show up in 'rabbitmqctl list_connections'? If so you 
can close them with 'rabbitmqctl close_connection ...'.

If the dead connections cause problems and occur on a regular basis you 
may want to get the clients to request heartbeats (see 
http://www.rabbitmq.com/releases/rabbitmq-java-client/v2.0.0/rabbitmq-java-client-javadoc-2.0.0/com/rabbitmq/client/ConnectionFactory.html#setRequestedHeartbeat(int) 
for how to do this in the Java client; other AMQP clients ought to have 
a similar API). That will detect dead connections and close them.


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list