eandersson / amqpstorm

Thread-safe Python RabbitMQ Client & Management library
https://www.amqpstorm.io/
MIT License
186 stars 36 forks source link

Channels are left idle on Error #36

Closed thejuan closed 7 years ago

thejuan commented 7 years ago

We use a version of scalable_consumer where we attempt to re-open the channel on AmqpChannelError rather than destroying the entire connection.

However, this leads to a channel leak. The channels are never removed from the channel list on the server. I have noticed that on a channel error that CloseOk is never sent... the spec (to me) is unclear as to whether it is necessary but maybe it is as the channels are never fully closed on the server. (v3.5.8)

I attempt to bind to an non-existent queue to cause the error in testing.

thejuan commented 7 years ago

RabbitMq is expecting a CloseOk on Error. Despite my opinion it is a bug on the server looks like they are forcing client libraries to send the CloseOk

https://github.com/rabbitmq/rabbitmq-server/issues/10

eandersson commented 7 years ago

Adding CloseOk as a response should be easy - I'll get that implemented in the next revision soonTM.

eandersson commented 7 years ago

I implemented a response to Channel.Close, but reading over the issue I am not sure if it is enough to handle to just handle the Channel.Close frame, or if this also needs to extend to other errors.

Let me know if you can test this out and thanks for the report!

thejuan commented 7 years ago

Channels are being closed on server after channel error occur now. Thanks!

eandersson commented 7 years ago

Sweet - I implemented a few more improvements to make sure that channels are closed gracefully.