Repository navigation
Add deterministic EventMonitor replay shutdown test - #240
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The replay barrier can time out and still satisfy every assertion, allowing the regression test to pass without exercising shutdown cancellation.
1 open issue
What changed in this PR
This test-focused PR strengthens replay-shutdown coverage for #235’s EventMonitor fix without changing production behavior or claiming to reproduce #238’s crash.
Changes:
- Replaces sleep-based replay testing with batch and shutdown synchronization.
- Adds test-only hooks to track event processing and handle closure.
- Enables the hooks and thread support in the test build.
| File | Description |
|---|---|
| LogMonitor/src/LogMonitor/EventMonitor.h | Declares test-only replay hooks and constructor parameter. |
| LogMonitor/src/LogMonitor/EventMonitor.cpp | Adds guarded synchronization and event counters. |
| LogMonitor/LogMonitorTests/pch.h | Enables test hooks and includes thread support. |
| LogMonitor/LogMonitorTests/EventMonitorTests.cpp | Replaces timing-based checks with synchronized shutdown assertions. |
Review effort: Balanced
|
Thanks Putluru Sandeep (@sunny-kavixo) -- this is a useful, well-scoped addition to #235. I independently checked commit Local evidenceUsing an isolated checkout, an x64 Release CMake build, and VSTest filtered to
The no-delay negative control failed with: The delayed negative control incorrectly passed (TRX duration approximately 6.32 seconds). The delay models the test thread being descheduled after receiving Suggested follow-up
Please keep the artificial delay and cancellation removal confined to the negative-control experiment, not the final patch. Increasing the timeout alone would only make the false positive less likely, rather than close it. This supports the existing review finding rather than identifying a separate issue. These experiments validate the test's cancellation coverage; they do not establish the faulting instruction behind #238's original crash. No changes were pushed to your branch. |
|
Thanks for identifying the barrier-timeout false positive. I've addressed this in commit The replay worker now records the Windows validation completed successfully:
Verification evidence: The correction remains test-scoped, with no intended production behavior changes. I'd appreciate a re-review of the updated commit. |
bob sira (bobsira)
left a comment
There was a problem hiding this comment.
Thanks for contributions!
151eb31
into
microsoft:fix/logmonitor-lint

Summary
This is a test-focused contribution to #235, targeting its
fix/logmonitor-lintbranch rather than competing with its production fix.The existing
TestShutdownDuringReplaysleeps for 100 ms, so it can pass without proving that shutdown interrupts a replay batch. This change adds test-only synchronization that:EvtNextreturns a real replay batch;The hooks are guarded by
LOGMONITOR_TESTSand compile out of production builds.Evidence
CheckForStop()block caused the test to fail on its first run withExpected:<0> Actual:<1> - Replay processed an event after shutdown was requested.cpplint==2.0.2passed on all changed C++ files in both runs.This does not claim to reproduce the original large-backlog crash in #238. It closes the deterministic regression-coverage gap identified in the review of #235.
Related: #238