Skip to content

Process.stop() lacks SIGKILL fallback — LSP processes become zombies #36558

Description

@beowulfof

Summary

Process.stop() in packages/opencode/src/util/process.ts sends only proc.kill() (SIGTERM) with no timeout and no SIGKILL escalation. If an LSP server ignores SIGTERM (e.g. rust-analyzer, clangd, Java-based servers), the process remains as a zombie.

Root Cause

The abort handler in Process.spawn() (same file) already has the correct pattern: SIGTERM → 5s timeout → SIGKILL. But stop() was written as a simple synchronous proc.kill() without any follow-up.

Impact

  • Orphaned LSP processes accumulate, consuming memory and file descriptors
  • Instance disposal hangs if a server doesn't respond to SIGTERM
  • The process.exit() fallback in index.ts only cleans up on main-process exit, not during normal operation

Steps to Reproduce

  1. Use an LSP server that ignores SIGTERM (e.g. some configurations of rust-analyzer or clangd)
  2. Close the project or instance
  3. The LSP process remains running

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions