fix(runtime): use private synchronization lock for ActivationData#10068
Draft
ReubenBond wants to merge 1 commit into
Draft
fix(runtime): use private synchronization lock for ActivationData#10068ReubenBond wants to merge 1 commit into
ReubenBond wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Orleans Runtime activation synchronization by introducing a private lock object on ActivationData and routing external activation-locking call sites to use it, instead of locking on activation instances or command objects. This aims to reduce accidental lock coupling and make activation state synchronization more explicit and controllable across the runtime.
Changes:
- Added a private synchronization lock to
ActivationDataand replacedlock(this)withlock(_lock)for mutable activation state. - Updated external call sites (
ActivationCollector, activation migration acceptance, and incoming request workload monitoring) to lock using the activation synchronization lock. - Updated activation command cancellation/disposal synchronization to use a private lock object instead of locking on the command instance.
Show a summary per file
| File | Description |
|---|---|
| src/Orleans.Runtime/Catalog/IncomingRequestMonitor.cs | Uses activation.SynchronizationLock when analyzing activation workload. |
| src/Orleans.Runtime/Catalog/ActivationMigrationManager.cs | Uses activation.SynchronizationLock when polling activation state during migration acceptance. |
| src/Orleans.Runtime/Catalog/ActivationData.cs | Introduces _lock, exposes SynchronizationLock, replaces internal lock(this) usage, and adds GetSynchronizationLock helper for collector call sites. |
| src/Orleans.Runtime/Catalog/ActivationCollector.cs | Locks collectible contexts via ActivationData.GetSynchronizationLock(...) instead of locking on the context instance. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ac3c1c8 to
25ab5d6
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
ActivationDataand uses it instead of locking on the activation instance.ActivationCollector, activation migration acceptance, and incoming request monitoring) through the same synchronization lock.Validation
git diff --check HEAD^ HEADdotnet build src\Orleans.Runtime\Orleans.Runtime.csproj -m --no-restore -v:qdotnet test test\Orleans.Core.Tests\Orleans.Core.Tests.csproj --filter FullyQualifiedName~ActivationCollectorTests(28 passed; existing xUnit serialization warnings only)Notes
Microsoft Reviewers: Open in CodeFlow