Repository navigation
fix(streaming): prevent ADO.NET stream message loss on out-of-order dequeue - #11527
Merged
ReubenBond merged 3 commits intoOct 21, 2026
Merged
Conversation
Contributor
Author
|
Do you want an end-to-end test for this too? Something like a two-silo cluster where one shuts down while it still has unconfirmed messages. There's nothing like that for ADO.NET streams right now. Problem is that the loss depends on timing tho. |
Contributor
Code coverage
Report-only conclusion: improved. The current-main baseline is commit Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities. The comparison remains report-only while normal line and branch variance is calibrated. Coverage details |
ReubenBond
force-pushed
the
fix/adonet-streaming-message-order
branch
from
October 19, 2026 21:04
50fadcc to
3b6466f
Compare
ReubenBond
approved these changes
Oct 21, 2026
ReubenBond
pushed a commit
to ReubenBond/orleans
that referenced
this pull request
Oct 22, 2026
…equeue (dotnet#11527) (cherry picked from commit 3fe31e2) Upstream-PR: dotnet#11527 Upstream-Commit: 3fe31e2
ReubenBond
pushed a commit
that referenced
this pull request
Oct 23, 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.
The ADO.NET stream provider used the database
MessageIdas the sequence token.SimpleQueueCacheassumes tokens increase in the order messages are dequeued, andMessageIddoesn't:OUTPUTand PostgreSQLRETURNINGdon't guarantee row order, so a single read can come back out of order and the cursor skips the older rows.MessageIdtwice in one confirmation batch. Every provider rejects that with a primary-key violation, so nothing in the batch gets confirmed.The result is consumers silently missing messages, mostly around silo shutdown and queue rebalancing. This matches the ADO.NET reports in #9126.
Changes:
MessageId.AdoNetBatchContainerkeeps theMessageIdin a non-serialized field for confirmation.AdoNetStreamPositionsmaps positions back to message IDs for the failure handler. If a position no longer resolves, the handler skips it.MessageId, keeping the highest dequeue count. That's the only count the database row will accept.Tokens are still
EventSequenceTokenV2and the SQL scripts are unchanged, so mixed-version clusters and existing databases are fine. All changed types are internal. One behavior change: a token'sSequenceNumberis now a local cache position, not theMessageId. The provider isn't rewindable and doesn't accept user tokens, so nothing should depend on that.Related to #9126
Microsoft Reviewers: Open in CodeFlow