However, this behavior blocks pending links to establish the connection. Because in _state_changed of sender/receiver, it will check self._session._link_error and find error is not None -- the error is caused by the last link establishment.
https://github.com/Azure/azure-uamqp-python/blob/master/uamqp/sender.py#L170
The variable session._link_error is not cleaned up when new links want to establish connection.
To Reproduce
Steps to reproduce the behavior:
Using ServiceBus write-only connection string for a queue:
with client:
try:
with client.get_queue_receiver(QUEUE_NAME) as receiver:
messages = receiver.receive(max_batch_size=1, timeout=1)
except Exception as e:
assert isinstance(e, ServiceBusError)
# hotfix, reset _link_error to None before next link establishment
# client._connection.auth._session._link_error = None
with client.get_queue_sender(QUEUE_NAME) as sender:
sender.send(Message("test"))
try:
sender.send("cat")
except Exception as e:
assert isinstance(e, ServiceBusError)
Describe the bug
When multiples links (sender/receiver) are sharing the same session, if one of these links gets into error state, the
uamqp.Session
would markself._link_error
: https://github.com/Azure/azure-uamqp-python/blob/master/uamqp/session.py#L48However, this behavior blocks pending links to establish the connection. Because in
_state_changed
of sender/receiver, it will checkself._session._link_error
and find error is not None -- the error is caused by the last link establishment. https://github.com/Azure/azure-uamqp-python/blob/master/uamqp/sender.py#L170The variable
session._link_error
is not cleaned up when new links want to establish connection.To Reproduce Steps to reproduce the behavior:
Using ServiceBus write-only connection string for a queue: