Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Incorrect batch size estimation #46381

Open
VeselovAndrey opened this issue Oct 1, 2024 · 2 comments
Open

[BUG] Incorrect batch size estimation #46381

VeselovAndrey opened this issue Oct 1, 2024 · 2 comments
Assignees
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

Comments

@VeselovAndrey
Copy link

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

  1. Create batch(es)
ServiceBusSender sender = _serviceBusClient.CreateSender(queueName);
ServiceBusMessageBatch batch = await sender.CreateMessageBatchAsync(ct);
  1. Add messages to almost hit the limit (usign TryAddMessage to hit limit)
ServiceBusMessage sbMessage = GetNextMessage();
while (batch.TryAddMessage(sbMessage)) { sbMessage = GetNextMessage(); }

In my case batch.SizeInBytes was 261889 (MaxSizeInBytes == 262144)

  1. Try to send batch
await sender.SendMessagesAsync(batch, ct);

Got an exception:

Azure.Messaging.ServiceBus.ServiceBusException: The message (id:redacted, size:263525 bytes) is larger than is currently allowed (262144 bytes). (MessageSizeExceeded). For troubleshooting information, see
https://aka.ms/azsdk/net/servicebus/exceptions/troubleshoot.

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

@github-actions github-actions bot added 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 labels Oct 1, 2024
Copy link

github-actions bot commented Oct 1, 2024

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@jsquire jsquire assigned m-redding and unassigned JoshLove-msft Oct 1, 2024
@jsquire
Copy link
Member

jsquire commented Oct 1, 2024

@m-redding : Would you please take a look and coordinate with the Service Bus team? I'm not sure from context if the batch overhead calculation is off or the service is sending the wrong size limit on a link when opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants