Fix orphaned dictionary generation processes - #68
Conversation
- Stop dictionary command descendants after timeout or interruption - Fall back to ProcessHandle teardown when the platform tree kill reports failure - Cover timeout, interruption, and fallback cleanup with real process trees Impact: Failed dictionary generation no longer leaves orphaned subprocesses
There was a problem hiding this comment.
Sorry @barad1tos, you have reached your weekly rate limit of 1500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Reviewer's GuideThis PR ensures that dictionary generation commands terminate their entire process tree on timeout or interruption, while preserving the existing timeout behavior and interrupt semantics, and adds Unix-based tests that validate these teardown paths including a fallback strategy when the platform tree-kill fails. Sequence diagram for updated dictionary generation process teardownsequenceDiagram
participant SdefDictionaryFileGenerator
participant Runtime
participant Process
participant OSProcessUtil
participant ProcessHandle
SdefDictionaryFileGenerator->>Runtime: exec(shellCommand)
Runtime-->>SdefDictionaryFileGenerator: Process
SdefDictionaryFileGenerator->>Process: waitForProcess(process, timeout, timeUnit)
alt process finishes before timeout
Process-->>SdefDictionaryFileGenerator: waitFor(timeout, timeUnit) == true
else process times out
Process-->>SdefDictionaryFileGenerator: waitFor(timeout, timeUnit) == false
SdefDictionaryFileGenerator->>OSProcessUtil: killProcessTree(process)
alt killProcessTree returns false
SdefDictionaryFileGenerator->>Process: descendants()
loop for each descendant
SdefDictionaryFileGenerator->>ProcessHandle: destroyForcibly()
end
SdefDictionaryFileGenerator->>Process: destroyForcibly()
end
else InterruptedException thrown
Process-->>SdefDictionaryFileGenerator: InterruptedException
SdefDictionaryFileGenerator->>OSProcessUtil: killProcessTree(process)
alt killProcessTree returns false
SdefDictionaryFileGenerator->>Process: descendants()
loop for each descendant
SdefDictionaryFileGenerator->>ProcessHandle: destroyForcibly()
end
SdefDictionaryFileGenerator->>Process: destroyForcibly()
end
SdefDictionaryFileGenerator-->>SdefDictionaryFileGenerator: rethrow InterruptedException
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5690dcf437
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Keep timeout and interruption outcomes when cleanup APIs fail - Check every fallback termination request and log contextual cleanup issues - Strengthen process tests for completion, timing, live interruption, and recursive trees Impact: Dictionary load errors remain actionable without orphaning command processes
- Preserve descendant handles before a fallible platform tree kill can reparent them - Add a real-process regression covering parent-first termination fallback Impact: Dictionary timeouts and interruptions cannot leave reparented child processes running
── Summary ─────────────────────────────────
Dictionary generation commands could outlive a timeout or interruption, leaving their child processes running after the load had already failed. Terminate the full process tree on both paths while preserving the existing timeout result and interrupt handling contract.
── Changes ─────────────────────────────────
ProcessHandlefallback when the platform tree kill reports failure.── Validation ────────────────────────────────
./gradlew test koverXmlReport koverVerify verifyPlugin verifyPluginStructure detekt ktlintCheck --rerun-tasks --stacktrace— passed.── Notes ────────────────────────────────────
The existing five-second timeout, typed load failure behavior, and worker interrupt restoration remain unchanged.
Summary by Sourcery
Ensure dictionary generation processes terminate fully on timeout or interruption to avoid orphaned child processes.
Bug Fixes:
Tests: