ServiceBusReceiver receive_messages max_wait_time race condition locks the message but sends back empty list #35591 #35764
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Messaging
Messaging crew
needs-team-attention
This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Service Bus
Description
Package Version: 7.12.2
Operating System: MacOS and Ubuntu
Python Version: 3.8.18
We are using the Azure service bus SDK on Python. We have a simple piece of code to receive messages.
Receiving code:
If max_wait_time is set in ServiceBusReceiver.receive_messages, then a race condition can happen where a message gets locked by the receive_message action but receive_messages returns back an empty list, locking this message for the duration of the lockout period.
To Reproduce
Steps to reproduce the behavior:
We used max_wait_time to 2 and are receiving 1 message at a time
Spin up 10 workers, constantly calling the Receiving code above in a polling interval in a while loop
Have a sender send 100 or so messages to the queue 1 at a time with a decently large body
Actual Behavior
messages
are returned with those values. From our experiments roughly 2-4 messages out of 100 get put into the locked state without them being complete. The receive_messages method shouldn't lock a message unless it can return that message in full.Expected Behavior
The text was updated successfully, but these errors were encountered: