Skip to content

[SB] The connection was inactive for more than the allowed 240000 milliseconds  #31229

@nhtgl

Description

@nhtgl
  • Package Name: azure-servicebus
  • Package Version: 7.11.1
  • Operating System: macOS/ubuntu
  • Python Version: 3.8, 3.9, 3.10

Describe the bug
After resolving #29961 we've updated servicebus to 7.11.1 and now we're not seeing END frame errors like we used to, but instead we're seeing a lot of Connection closed with error: [b'amqp:connection:forced', b"The connection was inactive for more than the allowed 240000 milliseconds and is closed by container 'de9c0655b1684a31b24a94d4a733ed5e_G4S2'.", None] errors. That definitely is coming from

if frame[0]:
self._error = AMQPConnectionError(
condition=frame[0][0], description=frame[0][1], info=frame[0][2]
)
_LOGGER.error(
"Connection closed with error: %r", frame[0],
extra=self._network_trace_params
)
.

I'm not sure whether this should be considered an error message, but I don't really understand how this amqp protocol works.

I want to be clear about one thing that may have something to do with it: we create an instance of ServiceBusClient and use it outside of context manager, and the same for topic or queue senders. The reason for this approach is performance - we prefer connection being closed due to inactivity over manual connection closing (like with calling close or context manager). This seems reasonable to us, because other solution would be to initialize service bus worker thread that would monitor connection time and send messages asynchronously.

Most errors coming from 3rd party libraries I treat as something I should probably take care of or there is an issue I should resolve somehow. In this case, I don't think I could do anything more, so on one hand I would silence this logger, but other error may occur that I wouldn't know about.

I would be very grateful for your support 🙏

To Reproduce
Steps to reproduce the behavior:

  1. Probably leaving a connection hanging with no traffic for more than 240000 milliseconds

Expected behavior
Dunno, maybe this shouldn't be considered error? Just a warning that service was disconnected would be sufficient.

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

Additional context
We talked with @kashifkhan in #29961.
#29961 (comment)
#29961 (comment)
#29961 (comment)
#29961 (comment)

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.MessagingMessaging crewService Buscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.issue-addressedWorkflow: The Azure SDK team believes it to be addressed and ready to close.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions