Implement poisoned shard detection and handling in AzureStorageJobShardManager#9907
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements poisoned shard detection for durable job shard managers by tracking how often shards are “stolen” from dead silos and preventing further assignment once a configurable threshold is exceeded, addressing issue #9900 for Azure Storage and the in-memory implementation.
Changes:
- Added
DurableJobsOptions.MaxStolenCountto configure the poisoned-shard threshold. - Updated
AzureStorageJobShardManagerandInMemoryJobShardManagerto track “stolen count” and skip assignment once poisoned. - Added
InMemoryJobShardManagerTestscovering orphaned/stolen/poisoned shard assignment scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| test/NonSilo.Tests/DurableJobs/InMemoryJobShardManagerTests.cs | Adds tests for orphaned vs stolen shard reassignment and poison-threshold behavior. |
| src/Orleans.DurableJobs/JobShardManager.cs | Extends InMemoryJobShardManager with stolen-count tracking and poison-threshold logic. |
| src/Orleans.DurableJobs/Hosting/DurableJobsOptions.cs | Introduces MaxStolenCount option and documentation describing the behavior. |
| src/Azure/Orleans.DurableJobs.AzureStorage/AzureStorageJobShardManager.cs | Adds Azure blob metadata tracking (StolenCount, LastStolenTime) and poison-threshold enforcement. |
Comments suppressed due to low confidence (1)
src/Orleans.DurableJobs/JobShardManager.cs:218
- These 'if' statements can be combined.
if (isOrphaned || isFromDeadSilo)
{
if (ownership.Shard.StartTime <= maxDueTime)
{
// If stolen from dead silo, increment stolen count
if (isFromDeadSilo)
{
ownership.StolenCount++;
// Check if shard is poisoned
if (ownership.StolenCount > _maxStolenCount)
{
// Shard is poisoned - don't assign it
continue;
}
}
ownership.OwnerSiloAddress = SiloAddress.ToString();
stolenShards.Add(ownership.Shard);
}
}
ReubenBond
approved these changes
Feb 15, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace direct DurableJobsOptions constructor usage with IOptions<DurableJobsOptions> and remove redundant constructor overloads. Update Azure durable jobs tests to pass options via IOptions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6f7463a to
cbe7eb9
Compare
rkargMsft
pushed a commit
to rkargMsft/orleans
that referenced
this pull request
Feb 27, 2026
…rdManager (dotnet#9907) * feat: implement poisoned shard detection and handling in AzureStorageJobShardManager * Fix in-memory durable jobs MaxStolenCount wiring Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR 9907 review feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Use IOptions<DurableJobsOptions> in Azure shard manager Replace direct DurableJobsOptions constructor usage with IOptions<DurableJobsOptions> and remove redundant constructor overloads. Update Azure durable jobs tests to pass options via IOptions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename stolen shard terminology to adopted Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Reuben Bond <reuben.bond@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Fix #9900
Microsoft Reviewers: Open in CodeFlow