Zombie consumers, how do I garbage collect them?

141 views
Skip to first unread message

Parnell Springmeyer

unread,
Jul 6, 2015, 2:07:26 PM7/6/15
to rabbitm...@googlegroups.com
I am using the heartbeat to keep track of the connection but what happens if an exception is thrown by a consumer when consuming a message that kills it and a new consumer is spawned right away but the connection and channel were never lost. We end up with a lot of zombie consumers and I don't know how to prune them.

I attempted issuing a basic.cancel before basic.consume as a catch-all cancel for that specific consumer tag since I'm using a specific (instead of random) consumer tag. But that doesn't appear to cancel any of the zombie consumers.

Michael Klishin

unread,
Jul 6, 2015, 2:21:00 PM7/6/15
to Parnell Springmeyer, rabbitm...@googlegroups.com
What client do you use? What RabbitMQ version? What does `rabbitmqctl report` output? How can we reproduce the issue?

MK

On 6/7/2015, at 21:07, Parnell Springmeyer <par...@plumlife.com> wrote:

I am using the heartbeat to keep track of the connection but what happens if an exception is thrown by a consumer when consuming a message that kills it and a new consumer is spawned right away but the connection and channel were never lost. We end up with a lot of zombie consumers and I don't know how to prune them.

I attempted issuing a basic.cancel before basic.consume as a catch-all cancel for that specific consumer tag since I'm using a specific (instead of random) consumer tag. But that doesn't appear to cancel any of the zombie consumers.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Parnell Springmeyer

unread,
Jul 6, 2015, 2:43:42 PM7/6/15
to Michael Klishin, rabbitm...@googlegroups.com
I'm using the Erlang client. I don't believe this is a problem with RabbitMQ per-se but it's reproducible by spawning a separate consumer process and then killing that process and letting the supervisor start it up again, I end up with multiple consumers with the same tag and only one of them is actually active.

I think I might have to propagate the consumer failure out to the process responsible for the AMQP connection so that it gets restarted too.
--
Parnell Springmeyer
Cloud & Mobile Software at Plum Inc.

0xDCCF89258EAD874A

Michael Klishin

unread,
Jul 6, 2015, 2:46:18 PM7/6/15
to par...@plumlife.com, rabbitm...@googlegroups.com
On 6 Jul 2015 at 21:43:41, Parnell Springmeyer (par...@plumlife.com) wrote:
> I'm using the Erlang client. I don't believe this is a problem
> with RabbitMQ per-se but it's reproducible by spawning a separate
> consumer process and then killing that process and letting the
> supervisor start it up again, I end up with multiple consumers
> with the same tag and only one of them is actually active.
>
> I think I might have to propagate the consumer failure out to the
> process responsible for the AMQP connection so that it gets restarted
> too.

There are two Erlang clients: network (works much like clients in other languages)
and direct. Are you using the direct one? Error handling in it can indeed be quite a bit
different.

The idea is that Erlang client processes need to be monitored in your code because
a dying consumer isn’t necessarily a reason to kill its channel, leave alone connection,
so the library lets the user decide. 
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Parnell Springmeyer

unread,
Jul 6, 2015, 3:11:30 PM7/6/15
to Michael Klishin, rabbitm...@googlegroups.com
I'm definitely using the network driver. If I restart the process that owns the channel will that "clean up" the zombie consumers on the host?

Michael Klishin

unread,
Jul 6, 2015, 3:16:01 PM7/6/15
to par...@plumlife.com, rabbitm...@googlegroups.com
On 6 Jul 2015 at 22:11:28, Parnell Springmeyer (par...@plumlife.com) wrote:
> If I restart the process that owns the channel will that "clean
> up" the zombie consumers on the host?

If you close the channel all consumers should be deleted. Otherwise RabbitMQ
server is unaware of your consumer process death. 
Reply all
Reply to author
Forward
0 new messages