GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — OpenCode leaves an orphaned process when it itself is killed · Issue #11527 · anomalyco/opencode Closed Labels bugSomething isn't working DescriptionDescriptionWhen I run OpenCode programatically using When I kill the OpenCode instance I started by PID, it won't kill the sub-process since it has deparented. Bun will keep running until the orphaned process dies as it was never This is a problem for use-cases where OpenCode is invoked programmatically (Git hooks for qualitative validations, solutions for terminal mirroring not based on SSH but on Bun's Pluginsnone OpenCode version1.1.48 Steps to reproduceRun: console.log("Killing all OpenCode instance to ensure clean slate…"); await Bun.$`killall -KILL opencode`.nothrow(); console.log("Printing running OpenCode instances…"); console.log("\t(There should be none)"); await Bun.$`pgrep -fl opencode`.nothrow(); console.log("Starting OpenCode…"); const proc = await Bun.spawn(["opencode"]); console.log("Started OpenCode. PID:", proc.pid); const timeout = 100; console.log(`Waiting for ${timeout} ms for the orphan (worker?) to deparent…`); await Bun.sleep(timeout); console.log(`Killing OpenCode with PID ${proc.pid}…`); proc.kill("SIGKILL"); await proc.exited; console.log(`Killed OpenCode with PID ${proc.pid}. ${proc.signalCode}`); console.log("Printing running OpenCode instances…"); console.log("\t(There should be none, but there is one with PPID 1 - orphan)"); await Bun.$`pgrep -fl opencode`.nothrow(); console.log("Killing self to prevent blockage due to ref'd deparented process"); process.exit(); You will see that it starts off with no orphans, then it spawns OpenCode, waits for OpenCode to spawn the sub-process (maybe some worker?), but then the sub-process immediately becomes deparented. Next, the OpenCode instance that was started gets killed and we query running This script is re-entrant, on the next run, it will kill the orphan, run again and leave another orphan, demonstrating the problem. Screenshot and/or share linkNo response Operating SystemNo response TerminalNo response Reacted by Iman Mirzadeh and Hossein Alidaee Activity
MetadataMetadataAssigneesLabelsbugSomething isn't working TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |