Repository navigation
fix: verify ancestry for orphaned intermediate fork (closes #721) - #789
Merged
s2x merged 1 commit intoAug 27, 2026
Merged
Conversation
The fingerprint branch in ProcessInspector::killOrphanedIntermediateFork() required $parentPid === fingerprint->pid, but in daemon mode the fingerprint is written by the master itself so it always names the master PID, never the intermediate's — the branch was dead in the production daemon flow. Add ancestry verification: getParentPid( fingerprint->pid) === parentPid plus a Workerman master title check on the parent, so the hung daemonize intermediate is killed only when it really is the parent of the fingerprinted master and looks like a Workerman master (shell in non-daemon mode is not killed). Extract isWorkermanMasterTitle() helper and keep the legacy fallback via the same helper. Add two Linux-only integration tests pinning the ancestry branches (kill when title matches, no-kill when title missing) via a real parent→child hierarchy. Co-authored-by: OpenCode <opencode@anomalyco.dev>
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.
Description
Closes #721
ProcessInspector::killOrphanedIntermediateFork()fingerprint branch required$parentPid === $fingerprint->pid, but in daemon mode the fingerprint is written by the master itself (MasterWorker::saveMasterPid()) so it names the master PID — never the intermediate's — and the branch never fired. The orphaned daemonize intermediate was only ever killed via the legacy/proccmdline path, which is unreachable when a fingerprint exists, so daemon intermediates leaked.Changes
src/ProcessInspector.php: keep direct identity check (matchesFingerprint(parentPid, fingerprint)) for the non-daemon/matching-PID case, add ancestry checkgetParentPid(fingerprint->pid) === parentPidplus a Workerman master title check (isWorkermanMasterTitle()) on the parent, so the hung intermediate is killed only when it really is the parent of the fingerprinted master and looks like a Workerman master (shell in non-daemon mode is not killed). ExtractisWorkermanMasterTitle()helper.tests/ProcessInspectorTest.php: add two Linux-only integration tests pinning the two ancestry branches via a realparent → childhierarchy built with a temp script exec'd withWorkerMan: master processtitle (exec -a) and marker-file synchronisation.CHANGELOG.md: entry under[Unreleased] Fixedfor [Bug] killOrphanedIntermediateFork() fingerprint path can never fire in daemon mode — intermediate PID is compared to the master fingerprint #721.Changelog
Added entry for #721 under
[Unreleased] Fixed.Proof of Work
docs/proof_of_work/0721-killorphanedintermediatefork-ancestry/— 2 review rounds (review-1.md, review-2.md + 2 code-decision files)Code Review