fix: dispose IProcessInvoker in Docker/Container/UnixUtil call sites#4378
Open
herbenderbler wants to merge 1 commit intoactions:mainfrom
Open
fix: dispose IProcessInvoker in Docker/Container/UnixUtil call sites#4378herbenderbler 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
Fixes a managed-memory/resource leak in runner container/unix execution paths by ensuring IProcessInvoker instances created via HostContext.CreateService<IProcessInvoker>() are properly disposed after use.
Changes:
- Wrap
IProcessInvokercreation inusingblocks across Docker/container execution andUnixUtil.ExecAsync. - Add L0 tests to verify
CreateService<IProcessInvoker>()results are disposed (including exception paths). - Add PR-audit documentation and adjust
.gitignore.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Runner.Worker/Container/DockerCommandManager.cs | Dispose per-call IProcessInvoker instances in docker command execution paths. |
| src/Runner.Worker/ContainerOperationProvider.cs | Dispose per-call IProcessInvoker in ExecuteCommandAsync output-capture path. |
| src/Runner.Common/Util/UnixUtil.cs | Dispose per-call IProcessInvoker in ExecAsync, keeping handler unsubscribe safety. |
| src/Test/L0/ProcessInvokerDisposalL0.cs | Adds disposal-pattern tests for CreateService + using and exception paths. |
| src/Test/L0/Util/UnixUtilL0.cs | Adds UnixUtil-focused disposal verification tests on non-Windows. |
| PR_DESCRIPTION_F1.md | Adds a PR/audit write-up describing the leak and fix. |
| .gitignore | Adjusts ignore patterns (currently impacts Rider .DotSettings.user ignores). |
e55defd to
9490e0a
Compare
9490e0a to
5831d64
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
IProcessInvokerinstances created viaHostContext.CreateService<IProcessInvoker>()in a few Docker/container/unix paths were not disposed.Because
CreateServicereturns a new instance per call, those paths could retain process-related resources longer than needed on long-lived runners.What Changed
IProcessInvokerusage inusingscopes in:src/Runner.Worker/Container/DockerCommandManager.cssrc/Runner.Worker/ContainerOperationProvider.cssrc/Runner.Common/Util/UnixUtil.cssrc/Test/L0/ProcessInvokerDisposalL0.cssrc/Test/L0/Util/UnixUtilL0.csWhy This Is Safer
Test Plan
git diff --checkand IDE lints are clean.