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 — fix(opencode): prevent resource leaks in serve/web shutdown and SSE stream cleanup by s2bomb · Pull Request #14092 · anomalyco/opencode ConversationWhat does this PR do?Fixes #14091 Two resource cleanup bugs in the
Changesserve.ts and web.ts — Add signal handlers following the existing pattern from const shutdown = async () => { await Promise.race([Instance.disposeAll(), new Promise((resolve) => setTimeout(resolve, 5000))]) server.stop(true) process.exit(0) } process.on("SIGTERM", shutdown) process.on("SIGINT", shutdown) server.ts — Add How did you verify your code works?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
server.stop() after await new Promise(() => {}) is unreachable dead code.
No signal handlers exist, so SIGTERM/SIGINT use the kernel default and
Instance.disposeAll() never runs — orphaning MCP subprocesses, LSP servers,
file watchers, and SQLite connections.
Add signal handlers following the existing pattern from worker.ts:137-147:
timeout-bounded Instance.disposeAll() + server.stop(true) + process.exit(0).
clearInterval(heartbeat) and unsub() only run inside stream.onAbort(), which Hono only fires on client disconnect. When the server closes the stream on InstanceDisposed via stream.close(), the interval and bus subscription leak. Add cleanup before stream.close() in the InstanceDisposed handler. Both calls are idempotent so the onAbort fallback for normal client disconnects still works.
This was referenced
This was referenced
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Memory leak:serve and web commands leak child processes on exit; SSE heartbeat interval leaks on server-initiated close
Uh oh!
There was an error while loading. Please reload this page. 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. | |
| 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. |