azure-sdk-for-python: Error amqp:link:detach-forced causes send_messages to timeout for 7s.

  • Package Name: azure-servicebus
  • Package Version: 7.13.0
  • Operating System: Ubuntu 20
  • Python Version: python3.12

Describe the bug We are experiencing a bug where our sender.send_messages are taking longer than 7s to send a message every 10 minutes.

Image

After careful investigation we determined that this line in servicebus.py raises an exception

    @trace_function
    def _send(
        self,
        message: Union[ServiceBusMessage, ServiceBusMessageBatch],
        timeout: Optional[float] = None,
        last_exception: Optional[Exception] = None,  # pylint: disable=unused-argument
    ) -> None:
        self._amqp_transport.send_messages(self, message, _LOGGER, timeout=timeout, last_exception=last_exception)

the exception being

Error condition: amqp:link:detach-forced
Error Description: The link 'G0:38070458:85065d4d-9298-4e43-b9cc-6aba5173f804' is force detached. Code: publisher(link88573). Details: AmqpMessagePublisher.IdleTimerExpired: Idle timeout: 00:10:00.

                                               File /venv/lib/python3.12/site-packages/azure/servicebus/_transport/_pyamqp_transport.py, line 498, in send_messages
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 701, in send_message
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 294, in _do_retryable_operation
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 273, in _do_retryable_operation
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 671, in _send_message_impl
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 406, in client_ready
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 603, in _client_ready
                                                               File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/link.py, line 112, in get_state
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 273, in _do_retryable_operation
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 671, in _send_message_impl
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 406, in client_ready
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 603, in _client_ready
                                                               File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/link.py, line 112, in get_state
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 273, in _do_retryable_operation
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 671, in _send_message_impl
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 406, in client_ready
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 603, in _client_ready
                                                               File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/link.py, line 112, in get_state
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 273, in _do_retryable_operation
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 671, in _send_message_impl
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 406, in client_ready
                                                             File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/client.py, line 603, in _client_ready
                                                               File /venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/link.py, line 112, in get_state

Which is https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-amqp-troubleshoot which does not provide details on how to mitigate this issue.

Our question is can we either prevent this exception from being raised? If not, can we prevent the 7s delays from occurring?

To Reproduce Steps to reproduce the behavior:

  1. call sender.send_messages with a credential, wait 20 minutes, then do it again.

Expected behavior The second call should take about the same time as the first call being less than 1s to execute.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (8 by maintainers)

Most upvoted comments

Hi @l0lawrence you are right thanks for correcting that mistake. It seems to be working fine now.