GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing github.com — fix(persistence): make persistent state operations concurrency-safe by ReubenBond · Pull Request #10255 · dotnet/orleans Conversation
|
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This PR makes StateStorageBridge<TState> serialize storage operations (read/write/clear) to prevent overlapping operations against the same in-memory state/ETag during reentrant grain execution, and adds targeted concurrency tests to validate coalescing and ordering behaviors.
Changes:
StateStorageBridge<TState> for read/write/clear operations, including write/clear coalescing and “read satisfied by predecessor” behavior.IStorage.*Async(CancellationToken) without canceling the underlying queued storage operation.IStorage/IPersistentState.| File | Description |
|---|---|
| test/Orleans.Core.Tests/Storage/StateStorageBridgeConcurrencyTests.cs | Adds concurrency-focused unit tests validating the new serialized/coalesced storage operation behavior. |
| src/Orleans.Runtime/Storage/StateStorageBridge.cs | Serializes storage operations via an internal queued-operation tail and adds explicit IStorage cancellation-token dispatch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
73ebd0d to
2c7ee4e
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Serialize storage reads, writes, and clears in StateStorageBridge so injected IPersistentState instances are concurrency-safe by default while preserving write coalescing. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3536a7cc-e412-4016-a017-52640074e072
Update the StateStorageBridge concurrency tests so successful write and clear operations assign fresh pseudo-random ETags and the scheduling tests assert the resulting ETag behavior. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3536a7cc-e412-4016-a017-52640074e072
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 96fb7f2b-cc70-4b64-b137-da3b83c1e1bd
2c7ee4e to
09964a7
Compare
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 96fb7f2b-cc70-4b64-b137-da3b83c1e1bd
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 96fb7f2b-cc70-4b64-b137-da3b83c1e1bd
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
docs/site/src/content/docs/tutorials-and-samples/custom-grain-storage.md:34
CancellationToken overloads on IGrainStorage operations (added in #10641). Without this, the doc implies only the cancellation-free methods are relevant, which is now inaccurate and could lead provider authors to miss cancellation propagation behavior.Consider reintroducing a short paragraph noting that Orleans will call the CancellationToken overloads when available, and that the new overloads have default interface implementations which delegate to the existing methods (preserving compatibility).
Therefore, `stateName` and `grainState.State?.GetType().Name` aren't interchangeable. The first identifies one of a grain's logical state records and is stable independently of the payload implementation. The second is only the runtime type name of the current payload; it can be `null`, can differ from `typeof(T)` when polymorphism is involved, and can change during a refactoring. The sample uses `stateName` and `grainId` for identity and delegates payload type handling to the configured serializer.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 96fb7f2b-cc70-4b64-b137-da3b83c1e1bd
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
src/Orleans.Runtime/Storage/StateStorageBridge.cs:150
operation = tail path), this call does not perform any runtime-context validation. A non-activation thread can therefore call ClearStateAsync() during the coalescing window and receive a successfully-completing Task, bypassing the intended "Activation access violation" guard. private Task ClearStateInternalAsync(CancellationToken cancellationToken)
{
QueuedStorageOperation operation;
lock (_storageOperationLock)
{
if (!cancellationToken.CanBeCanceled
&& _storageOperationTail is { Kind: StorageOperationKind.Clear, Started: false, CanBeCanceled: false } tail)
{
operation = tail;
}
else
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 96fb7f2b-cc70-4b64-b137-da3b83c1e1bd
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.