Skip to content

MCP stdio server can remain running after parent process exits #406

@nvt-pankajsharma

Description

@nvt-pankajsharma

Summary

When the MCP stdio server is launched by an agent/runtime and the parent process exits unexpectedly, the child codebase-memory-mcp process can keep running. That orphaned process may continue holding memory and contribute to out-of-memory conditions over time.

Expected behavior

The stdio MCP server should terminate when its launching parent process dies, matching the lifecycle of the agent/runtime that owns the stdio session.

Actual behavior

If the parent process dies without cleanly closing stdio, the server can remain alive as an orphaned process.

Proposed fix

Add a POSIX parent-process watchdog for the stdio MCP server and cover it with a regression script that kills the parent wrapper and verifies the child exits. Windows should remain explicitly skipped until a Windows-specific parent-death mechanism is added.

Validation plan

  • scripts/test.sh
  • scripts/lint.sh --ci
  • scripts/build.sh CC=cc CXX=c++
  • make -f Makefile.cbm security

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingeditor/integrationEditor compatibility and CLI integration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions