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(testing): isolate reminder event continuations by ReubenBond · Pull Request #10899 · dotnet/orleans Conversation
|
| Severity | Finding |
|---|---|
test/Orleans.Testing.Reminders/ReminderDiagnosticObserver.cs — WaitForEventAsync subscribes with only OnNext/OnError. If the observable completes without… |
This PR addresses a flaky reminders test by ensuring that waits on reminder diagnostic events do not resume continuations inline on the diagnostic event emitter thread, aligning reminder diagnostic wait behavior with other lifecycle-state waiters.
Changes:
FirstAsync(...).ToTask(...) conversions with a TaskCompletionSource-based wait using RunContinuationsAsynchronously.ExecuteSynchronously continuation attached to WaitForReminderServiceStartedAsync does not run inline.| File | Description |
|---|---|
| test/Orleans.Testing.Reminders/ReminderDiagnosticObserver.cs | Introduces WaitForEventAsync using TaskCompletionSource(...RunContinuationsAsynchronously) and refactors reminder/service wait helpers to use it. |
| test/Orleans.Reminders.Tests/Diagnostics/ReminderEventsTests.cs | Adds a regression test to validate that service-start wait continuations do not run inline on the event emission thread. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Review tier: Lite
Findings: None
| Severity | Finding |
|---|---|
test/Orleans.Testing.Reminders/ReminderDiagnosticObserver.cs — WaitForEventAsync subscribes with only OnNext/OnError. If the observable completes without… View resolved comment |
Previously missed (1) — in code that hasn't changed since the last review.
test/Orleans.Testing.Reminders/ReminderDiagnosticObserver.cs:335
WaitForEventAsync calls predicate(value) inside the subscription callback without handling exceptions. If the predicate throws, the exception will escape the Rx OnNext delegate (potentially crashing the event producer) and the returned task will never complete or clean up its registration/subscription. This is a semantic regression compared to FirstAsync(predicate) which faults the sequence when the predicate throws. value =>
{
if (!predicate(value))
{
return;
Sorry, something went wrong.
There was an error while loading. Please reload this page.
f6040e8 to
758a6ac
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Review tier: Lite
Findings: 1
| Severity | Finding |
|---|---|
test/Orleans.Testing.Reminders/ReminderDiagnosticObserver.cs — The cancellation callback disposes the subscription and cancels the task, but the… |
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Review tier: Lite
Findings: 1
| Severity | Finding |
|---|---|
test/Orleans.Testing.Reminders/ReminderDiagnosticObserver.cs — WaitForEventAsync evaluates predicate(value) directly inside the observer OnNext callback. If… |
| Severity | Finding |
|---|---|
test/Orleans.Testing.Reminders/ReminderDiagnosticObserver.cs — The cancellation callback disposes the subscription and cancels the task, but the… View resolved comment |
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Review tier: Lite
Findings: None
| Severity | Finding |
|---|---|
test/Orleans.Testing.Reminders/ReminderDiagnosticObserver.cs — WaitForEventAsync evaluates predicate(value) directly inside the observer OnNext callback. If… View resolved comment |
Previously missed (1) — in code that hasn't changed since the last review.
test/Orleans.Reminders.Tests/Diagnostics/ReminderEventsTests.cs:58
Assert.NotEqual(emitterThread, continuationThread) is currently comparing the continuation thread against the test thread (the one calling EmitReminderServiceStarted). TaskCreationOptions.RunContinuationsAsynchronously guarantees the continuation is not invoked inline on completion, but it does not guarantee it will run on a different managed thread than the caller (a ThreadPool thread can dequeue its own queued work later). This can make the regression test flaky and fail even when continuations are correctly asynchronous.A more robust regression is to emit the event from a dedicated non-ThreadPool Thread and assert the continuation does not run on that emitter thread.
ReminderEvents.EmitReminderServiceStarted(siloAddress);
Assert.True(continuationRan.Wait(TimeSpan.FromSeconds(5), TestContext.Current.CancellationToken));
Assert.NotEqual(emitterThread, continuationThread);
}
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.
Successfully merging this pull request may close these issues.
Flaky test: ReminderTestKit_StaleRefreshCannotRestoreUnregisteredReminder times out
There was an error while loading. Please reload this page.