Closed haudren-woven closed 2 years ago
Duplicate of #446
I mentioned it in my original text, but this issue is not an exact duplicate of #446, although it's really close. The new check introduced by #446 checks:
closed_by_user
: False
in my caseconnection.is_closed
: False
in my caseAMQPFrameError
, in my case closed by ConnectionError
So the check evaluates to True, and reopen
is called despite being in the middle of a reconnection.
Thank you for your understanding.
I think that should be fixed in 7.1.1
If I am not mistaken, 7.1.1
only includes #446 , and as I mentioned above it does not address my issue directly, since the connection attempt fails with ConnectionError
. But I must say that I'm a little confused as to why the RobustChannel
has some auto-reconnection logic as well as the RobustConnection
. It seems like it would be more straightforward to put all the logic in one or the other, but I am a relative beginner with AMQP, so I don't know what use-cases this can serve.
Should be fixed in #450
@haudren-woven the reason of splitting of reconnection logic is the channels might be closed from broker side without connection closing.
Thank you! I'll test it later but the fix and your explanation both make sense.
Tested today, this seems to have addressed the issue! Thank you very much :bow:
I just noticed that under the following circumstances:
connection.reconnect()
The restoration process fails with
aiormq.exceptions.DuplicateConsumerTag
. As I investigated further, it seems that the issue is that the channel is restored twice:And the barrier in the callback is not triggered, since these are the values of the variables:
closing
: <Future finished exception=ConnectionError(101, 'Network is unreachable')> [Errno 101] Network is unreachable, which is thus notAMQPFrameError
connection.closed
isFalse
However,
connection.reconnecting
isTrue
, so an easy fix is to add that to this list of exclusions, and I can submit a simple PR going in this direction. However, I wonder if it is the best way to fix that problem. It seems dangerous to have the reopening logic be called from two places, without locking. Please let me know what you prefer!See below for the full stack trace: