Repository navigation
Fix Log Monitor lint and EventMonitor shutdown - #235
Open
bob sira (bobsira) wants to merge 2 commits into
Open
bob sira (bobsira) wants to merge 2 commits into
bob sira (bobsira) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The replay-shutdown regression test needs deterministic synchronization to verify cancellation and cleanup while a replay batch still contains unprocessed events.
1 open issue
What changed in this PR
This PR strengthens Log Monitor’s C++ lint enforcement and fixes EventMonitor shutdown so worker resources are not released while still in use.
Changes:
- Apply shared lint rules to production and test sources, with CI failures independent of reviewdog annotations.
- Add cancellable Event Log reads and retries, worker joining, handle cleanup, and fail-fast shutdown handling.
- Add shutdown regression tests, restore stdout after EventMonitor tests, and document shutdown behavior.
| File | Description |
|---|---|
| LogMonitor/src/LogMonitor/Utility.cpp | Add explicit vector include. |
| LogMonitor/src/LogMonitor/ProcessMonitor.cpp | Add explicit string include. |
| LogMonitor/src/LogMonitor/pch.h | Adjust SDK include and lint suppression syntax. |
| LogMonitor/src/LogMonitor/Main.cpp | Add explicit standard-library includes. |
| LogMonitor/src/LogMonitor/LogFileMonitor.cpp | Add includes and remove extra whitespace. |
| LogMonitor/src/LogMonitor/JsonFileParser.cpp | Add vector include and explain Windows macro exception. |
| LogMonitor/src/LogMonitor/EventMonitor.h | Declare read timeout and cancellation interfaces. |
| LogMonitor/src/LogMonitor/EventMonitor.cpp | Implement cancellation, safe shutdown, and handle cleanup. |
| LogMonitor/src/LogMonitor/EtwMonitor.cpp | Add explicit standard-library includes. |
| LogMonitor/README.md | Document lint configuration and local checks. |
| LogMonitor/LogMonitorTests/UtilityTests.cpp | Apply lint-compatible formatting. |
| LogMonitor/LogMonitorTests/Utility.h | Add license header and string include. |
| LogMonitor/LogMonitorTests/Utility.cpp | Include helper declaration and use Win32 return type. |
| LogMonitor/LogMonitorTests/pch.h | Update header guard and include-order exceptions. |
| LogMonitor/LogMonitorTests/pch.cpp | Add narrow PCH lint exception. |
| LogMonitor/LogMonitorTests/LogMonitorTests.cpp | Document implementation includes and apply lint cleanup. |
| LogMonitor/LogMonitorTests/LogFileMonitorTests.cpp | Apply lint formatting and correct status types. |
| LogMonitor/LogMonitorTests/JsonProcessorTests.cpp | Add includes and apply lint formatting. |
| LogMonitor/LogMonitorTests/EventMonitorTests.cpp | Add shutdown tests, stdout cleanup, and profile-free event generation. |
| LogMonitor/LogMonitorTests/EtwMonitorTests.cpp | Add includes and apply lint formatting. |
| LogMonitor/docs/README.md | Document cancellation and fail-fast shutdown behavior. |
| LogMonitor/CPPLINT.cfg | Define shared lint rules. |
| .github/workflows/lint.yml | Pin lint tools, include tests, and separate enforcement from annotations. |
Review effort: Balanced
Comment on lines
+135
to
+136
| auto eventMonitor = std::make_unique<EventMonitor>(eventChannels, true, true, L"json", L""); | ||
| Sleep(WAIT_TIME_EVENTMONITOR_START); |
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
CPPLINT.cfgrules and run pinned cpplint 2.0.2 against all tracked C++ sources and headers, including tests. Retain reviewdog PR annotations and make lint diagnostics fail CI independently of annotation filtering.Shutdown behavior
Shutdown cancels outstanding Event Log replay rather than draining the backlog. Event reads use bounded waits and check for cancellation between batches and events. If signaling or joining the worker fails, or the existing five-second shutdown limit is exceeded, the process now fails fast instead of destroying an object still in use. The fatal path avoids acquiring the logger lock and carries the Win32 error in the exception.
Validation
The lint-only version still reproduced the pre-existing EventMonitor crash; including the separate shutdown-fix commit makes both full suites pass.