-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
- Package Name:
azure-servicebus - Package Version:
0.50.3 (Same issue will occur in 7.0.* as well) - Operating System:
All - Python Version:
All
Describe the bug
The ServiceBus Service has a connection idle_timeout of 240000 ms (4 minutes). Not only is this unclear to users, but if renew_period for autolockrenewal is set to >4 minutes, (when max lock duration is theoretically 5 minutes) the connection will time out silently.
To Reproduce
Steps to reproduce the behavior:
- Create a queue with lock duration of >4 minutes.
- Send and receive a message, attaching an autolockrenewer with a period >4 minutes.
- Observe that the message is now unable to be completed due to lock expiry. With all logging on, observe "the connection was inactive for more than the allowed 240000 milliseconds"
Expected behavior
There are a few options here of varying rigidity.
- Disallow improperly large renew_period.
- Warning/better docstring on renew period
- "secretly" run our own keepalive in the 4 minute interval if a large renew period is specified. (should this be a function of the receiver potentially flag-enabled? I'm spitballing.)
- Document this in our README (we should do this anyway)
- Potentially coupled with any of the above strategies, find a more immediate way to surface connection idle expiry. (@annatisch I hate that I keep finding myself saying "I wish we had an on error handler"; although this could be an issue with pull mode as well. Consider this a note to see how/if the other languages addressed this issue)
Additional context
Initially noted with the user in this thread
A final note I'd append here: We noticed very odd symptoms when trying to use a 5 minute service side lock_duration, wherein the expires_at time on the message would appear to be >5 minutes in the future, resulting in guaranteed lock renewal failures if you trusted it. This should be investigated in parallel with the core issue to see if we're just dealing with clock skew, or if there's actually some odd edge case there.