[BUG] Incorrect batch size estimation #46381
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.
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
Service Bus
Library name and version
Azure.Messaging.ServiceBus 7.18.1
Describe the bug
There is some error when estimating batch size.
Some batches (with size that almost hit size limit) were created but failed to send.
Expected behavior
Send created baches.
Actual behavior
Got the ServiceBusException: The message is larger than is currently allowed (262144 bytes).
Reproduction Steps
In my case batch.SizeInBytes was 261889 (MaxSizeInBytes == 262144)
Got an exception:
The message size became 263525 (was 261889)
Workaround: set MaxSizeInBytes when creating batch to 262144 - (2 * 1024) (default max size - 2KB)
Environment
Windows 11
.NET 8.0.402 / Console App
Visual Studio 17.11.4
The text was updated successfully, but these errors were encountered: