Repository navigation
[DurableTask.ServiceBus] Log messages dropped by MessageSender.SendAsync when they don't fit in the batch - #1425
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Large dropped-ID lists are truncated by the tracing layer, leaving the intended diagnostics incomplete.
2 open issues
What changed in this PR
This PR adds visibility into messages dropped by the Service Bus provider when they exceed a single batch’s capacity, without changing the existing single-batch send behavior.
Changes:
- Adds error tracing with dropped-message counts, body bytes, IDs, and batch context.
- Disposes the message batch after use.
- Documents that messages exceeding batch capacity are traced but not sent.
| File | Description |
|---|---|
| src/DurableTask.ServiceBus/Common/Abstraction/ServiceBusAbstraction.cs | Adds overflow diagnostics, batch disposal, and method documentation. |
Review effort: Balanced
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
No actionable correctness bugs or regressions found. The change logs messages rejected by TryAddMessage through the existing tracing mechanism and disposes the batch after the awaited send, without changing the existing single-batch delivery behavior. Oversized or overflow messages are still omitted as before; this PR adds diagnostics rather than fixing that pre-existing delivery limitation.
Reviewed the batching loop, message conversions, caller transaction flow, and error-event routing. The Service Bus project builds successfully with zero warnings or errors. No live Service Bus validation was performed, and the PR adds no tests for partial/all-rejected batches or the emitted log contents.


Summary
MessageSender.SendAsync(IEnumerable<Message>)adds every message to a singleServiceBusMessageBatchand ignores the result ofTryAddMessage. Any message that doesn't fit in the batch is never sent, and nothing records it.This PR makes these drops visible.
Changes
Errortrace is written with event typeMessageSender-SendAsync-MessagesDropped. It includes:Behaviour
Notes
All messages in one call share a single batch (256 KB on Standard, 1 MB on Premium), even though each message on its own stays below
MessageOverflowThresholdInBytes(170 KB by default). Large fan-outs can exceed the batch size: many activities scheduled in one episode, or the matching history tracking messages. When that happens, the extra messages are dropped and the new trace records them.Testing
DurableTask.ServiceBusbuilds with no warnings or errors.