You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
memory: over Streamable HTTP, shutdown during an in-flight write leaves the lock file behind #5595
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
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.
Call create_entities over HTTP.
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
fix(memory): release held locks when the Streamable HTTP server stops