fix(streaming): defer acknowledgements for batched delivery - #10655
Merged
ReubenBond merged 1 commit intoAug 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes a streaming acknowledgement timing bug when BatchContainerBatchSize > 1 by preventing SimpleQueueCache from purging/acknowledging queue messages while a combined (batched) consumer delivery is still in-flight.
Changes:
- Introduces an internal cursor capability (
IQueueCacheCursorBatchDelivery) to scope “batched delivery” protection and failure marking. - Updates
PersistentStreamPullingAgentto protect cache buckets across batched deliveries and to mark all items in a combined delivery as failed when delivery fails. - Extends
SimpleQueueCacheCursorto pin the earliest cache bucket for the duration of a combined delivery and to mark specific cache items as delivery failures. - Adds a regression test ensuring
MessagesDeliveredAsyncis not called until both consumers complete their deliveries.
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.Streaming.Tests/StreamingTests/PersistentStreamPullingAgentTests.cs | Adds a regression test covering premature acknowledgement during batched consumer delivery. |
| src/Orleans.Streaming/QueueAdapters/IQueueCacheCursorBatchDelivery.cs | Adds an internal interface for batch-delivery protection and per-batch failure recording. |
| src/Orleans.Streaming/PersistentStreams/PersistentStreamPullingAgent.cs | Wraps batched delivery with protection and records delivery failures at batch granularity. |
| src/Orleans.Streaming/Common/SimpleCache/SimpleQueueCacheCursor.cs | Implements batch-delivery protection by pinning the earliest bucket and supports marking specific items as delivery failures. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
Keep the earliest SimpleQueueCache bucket pinned until every combined consumer delivery completes, and retain every failed container for redelivery. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ReubenBond
force-pushed
the
rb-fix-903-premature-message-delivery
branch
from
August 19, 2026 07:18
e9c452a to
92afb72
Compare
This was referenced Aug 28, 2026
Merged
Merged
This was referenced Sep 8, 2026
Closed
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #903.
BatchContainerBatchSize > 1advances each consumer cursor across every included queue message before awaiting the combined delivery. WithSimpleQueueCache, that can leave the oldest bucket without a cursor while delivery is still in flight, allowingMessagesDeliveredAsyncto acknowledge and delete those messages prematurely.Keep the earliest cache bucket pinned for the lifetime of each combined consumer delivery. The last consumer completion releases the final pin, allowing purge and acknowledgement. Failed combined deliveries mark every contained cache item so each remains eligible for redelivery.
The regression uses two consumers blocked inside combined delivery and proves acknowledgement occurs only after both complete.
Microsoft Reviewers: Open in CodeFlow