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(web): dispose idle MCP server instances to prevent process accumulation by lytedev · Pull Request #15326 · anomalyco/opencode Conversation
|
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs that address similar issues with process management and cleanup: Potentially Related PRs:
These PRs appear to be addressing the same class of issues (process accumulation, memory leaks, signal handlers, and graceful shutdown) across different modes of the application. PR #14092 seems most relevant as it specifically targets web/serve shutdown issues. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
11afb64 to
243d613
Compare
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
243d613 to
42f10f1
Compare
…lation
In `opencode web` mode, switching projects creates new Instance entries (each
spawning MCP server child processes) that are never cleaned up. Unlike the TUI
which calls shutdown()/disposeAll() on exit, the web command blocks forever
with `await new Promise(() => {})` and never reaches its `server.stop()` call.
This causes unbounded process growth — each project switch leaks ~200MB of MCP
server processes (linear, notion, etc.) that persist for the lifetime of the
web server.
Fix:
- Add signal handlers (SIGINT, SIGTERM, SIGHUP) to the web command that call
Instance.disposeAll() with a 5s timeout before exiting
- Add idle eviction to Instance: track last access time per directory, sweep
every 60s, and dispose instances idle for >5 minutes
- Clean up lastAccess bookkeeping in dispose() and disposeAll()
42f10f1 to
9564686
Compare
|
Looks like other PRs that are similar have been merged. Will close this one! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully 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
There was an error while loading. Please reload this page.