question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Channel is closed and never reopened when InternalConsumer.HandleModelShutdown triggers

See original GitHub issue

Problem When a consumer is stuck for 30 minutes or longer (the default timeout after which RabbitMQ.Client automatically closes the channel1), the IBasicConsumer.HandleModelShutdown method is triggered, which logs that the channel was closed. The channel never recovers or gets reopened, and any future messages are never consumed.

  1. See https://www.rabbitmq.com/consumers.html#acknowledgement-timeout

Root Cause InternalConsumer (which is used by PersistentConsumer & friends) creates its own channel here: https://github.com/EasyNetQ/EasyNetQ/blob/f614ba6b555767ac1ae96c7405fb4bbca740e868/Source/EasyNetQ/Consumer/InternalConsumer.cs#L135

InternalConsumer does not emit an event of any kind when the channel is shutdown. (AQMP code is PreconditionFailed) After some digging, I found that there is a ChannelClosedEvent that gets emitted by PersistentChannel, but InternalConsumer does not emit this. InternalConsumer creates instances of IBasicConsumer, and these receive a callback on IBasicConsumer.HandleModelShutdown You can also register a callback via the ModelShutdown on IModel, which is what PersistentChannel does.

Suggested solution Emit ChannelClosedEvent on the IEventBus from InternalConsumer so that library users can handle this problem, and/or automatically create a new channel when this problem occurs so we can recover from this situation.

Using latest EasyNetQ 6.3.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Plinercommented, Sep 4, 2022

The issue was resolved in v7.

1reaction
Plinercommented, Jan 13, 2022

@amoerie just to start a discussion about the implementation #1327

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do my RabbitMQ channels keep closing?
An AMQP channel is closed on a channel error. Two common things that can cause a channel error: Trying to publish a message...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found