Sync eventhub bufferedproducer does not respect max_wait_time with threads<partitions #38961
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.
Event Hubs
feature-request
This issue requires a new behavior in the product in order be resolved.
Messaging
Messaging crew
needs-team-attention
Workflow: 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
Describe the bug
We use EventHubProducerClient (not async version) with buffered_mode=True. We noticed that for our 32-partition EH that messages in partition 8-31 always arrived in batches of size 1500, much later than max_wait_time (sometimes days after). Events in the earlier partitions arrived as expected.
We happen to be running this on a 4-core azure container app.
We noticed that if we set buffer_concurrency to 32 then max_wait_time seems respected for all partitions.
I think the problem is that the function check_max_wait_time_worker runs as an infinite loop (in the async version the sleep is awaited, which is an important detail) and is submitted to a shared threadpoolexecutor. If we do not set buffer_concurrency then the default threadpoolexecutor is made, with
min(32, os.cpu_count() + 4) = 8
threads. That is also the max amount of concurrent tasks the executor can process (even if the task is to sleep), socheck_max_wait_time_worker
for the higher partition numbers are never executed on the scheduler.The text was updated successfully, but these errors were encountered: