Skip to content

memory: over Streamable HTTP, shutdown during an in-flight write leaves the lock file behind #5595

Closed

Description

@cliffhall

Problem

Over Streamable HTTP, the memory server never registers the exit hook that removes a lock file the process still holds.

installLockCleanup() (#5485) is called only by main(), the stdio path. run() starts Streamable HTTP without it: on SIGINT or SIGTERM it awaits running.close() and calls process.exit(0). close() drops the open connections, but a tool call that is mid-write keeps running and still holds <memory file>.lock, so the process exits with the lock in place. A second signal during the shutdown is worse: the handlers are registered with process.once, so it takes the default action and no exit event fires at all.

The next writer then waits for the lock to go stale, which is the full staleMs when that writer is in another container and cannot see that this process has gone. That is the failure #5485 fixed for stdio.

Found by the Copilot review of the v2.5.0 merge PR (#5592, #5592 (comment)). Streamable HTTP for this server is new in v2.5.0 (#576), so nothing published has the defect.

Reproduce

  1. Start node dist/index.js --transport streamable-http with MEMORY_FILE_PATH on a file whose read blocks (a FIFO), so a write holds the lock.
  2. Call create_entities over HTTP.
  3. Send the server SIGTERM.

The process exits and <memory file>.lock is still there.

Expected

However the HTTP server process ends, a lock it still holds under its own token is removed, as it is over stdio. The graceful shutdown on the first signal stays; a second signal exits at once, still through the exit hook.

Activity

  1. added this to the v2.5.0 milestone on Nov 18, 2026
  2. self-assigned this
    on Nov 18, 2026
  3. added
    bugSomething isn't working
    server-memoryReference implementation for the Memory MCP server - src/memory
    on Nov 18, 2026
  4. added a commit that references this issue on Nov 18, 2026
    af86b99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserver-memoryReference implementation for the Memory MCP server - src/memoryv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions