fix: make PagingLogger IDisposable to prevent fd leak on step fault#4379
Open
herbenderbler wants to merge 1 commit intoactions:mainfrom
Open
fix: make PagingLogger IDisposable to prevent fd leak on step fault#4379herbenderbler wants to merge 1 commit intoactions:mainfrom
herbenderbler wants to merge 1 commit intoactions:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates PagingLogger to be disposable so file handles are deterministically released (and partial logs are still queued) when a step faults before End() is reached, preventing fd leaks and silent log loss.
Changes:
- Extend
IPagingLoggerwithIDisposableand implementPagingLogger.Dispose()(best-effort, idempotent, non-throwing). - Add L0 tests covering the new disposal contract and expected behavior on exception-like paths.
- Add a PR write-up document; update
.gitignore.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Runner.Common/Logging.cs | Makes IPagingLogger disposable and adds PagingLogger.Dispose() to flush/close and queue partial uploads safely. |
| src/Test/L0/PagingLoggerL0.cs | Adds new L0 tests validating IDisposable contract and disposal behavior (partial write, idempotence, using-pattern, etc.). |
| PR_DESCRIPTION_F4.md | Documents the bug, repro, and rationale for the IDisposable fix and tests. |
| .gitignore | Modifies ignore rule related to DotSettings / leakbench artifacts. |
6ca0ef8 to
c2304a0
Compare
c2304a0 to
2d27adb
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
PagingLoggercan lose partial step logs and hold file handles open when a step faults beforeExecutionContext.Complete()reaches_logger.End().This PR makes logger lifetime explicit: owned
PagingLoggerinstances are disposed when anExecutionContextcompletes, while shared embedded loggers are not double-disposed.What Changed
PagingLoggerdisposable behavior and focused disposal tests insrc/Test/L0/PagingLoggerL0.cs.src/Runner.Worker/ExecutionContext.cs:HostContext.CreateService<IPagingLogger>()as ownedComplete()viafinallyExecutionContextL0 tests insrc/Test/L0/Worker/ExecutionContextL0.csto verify:Why This Is Safer
Test Plan
PagingLoggerdisposal behavior tests pass in unit test environment.ExecutionContextownership tests cover the production ownership path.git diff --checkand IDE lints are clean.