memory: clean up active lock files on exit and termination signals
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- docker, node.js, typescript
Rechercherichtung
Read src/memory/index.ts, the lock handling in file-lock.test.ts, and src/memory/Dockerfile; compare signal handling with src/everything/transports/stdio.ts and src/everything/Dockerfile. Check the linked prototype branch for existing work. Done means active locks owned by this process are cleaned up on shutdown, locks owned by others are preserved, the Docker stop signal is configured, and the memory tests pass.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Which server?
memory (@modelcontextprotocol/server-memory)
Server version
2.1.0
How did you run the server?
From a clone of this repository
Transport
stdio
Protocol era
Modern (2026-07-28)
MCP client and version
Claude Desktop / Autonomous Agent Orchestrator
Operating system and runtime
Linux / Node.js v24+
Server configuration
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}
Steps to reproduce
- Run @modelcontextprotocol/server-memory.
- Dispatch a mutation tool call (e.g.
create_entitiesoradd_observations) that acquires the lock viawithFileLock. - Terminate or stop the server process via SIGINT, SIGTERM, client disconnect, or container stop during the operation.
- Inspect the directory holding
memory.jsonl. - Attempt a subsequent write from another agent or container sharing the same graph file.
Expected behavior
The server should register signal handlers (SIGINT, SIGTERM) and exit cleanup hooks to remove any active lock file it currently holds, preventing orphaned lock files on abrupt shutdown.
Actual behavior
In Node.js, asynchronous finally blocks in withFileLock do not run when terminated by signals. Because src/memory registers no signal handlers (unlike src/everything/transports/stdio.ts), memory.jsonl.lock remains stranded on disk.
In multi-container or Docker environments where hostname !== os.hostname(), isLockOwnerDead returns false, forcing other agents to stall for up to 30–60 seconds before breaking the stale lock.
Additionally, in src/memory/Dockerfile, Node runs as PID 1 without STOPSIGNAL SIGINT, causing PID 1 to ignore SIGINT by default.
Already prototyped a fix?
Prompt for maintainer workflow:
"In src/memory/index.ts, track active lock files held by this process in an
activeLocksmap. On process exit and on SIGINT/SIGTERM, synchronously check if the lock file still contains our token, and if so, unlink it to avoid leaving stranded locks on abrupt shutdown. Add STOPSIGNAL SIGINT to src/memory/Dockerfile matching src/everything/Dockerfile. Add unit tests in file-lock.test.ts verifying active lock tracking and that cleanup leaves locks owned by another process intact."
Verification:
- Implemented and verified: all 231 tests in
src/memorypassing. - Working branch pushed for reference: https://github.com/Faris-as/servers/tree/memory-lock-signal-cleanup
Before you submit
- I searched existing issues and this is not a duplicate.
- This is not a security vulnerability report.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 91.7k
- Forks
- 11.9k
- Ø Merge
- 3 Std. 30 Min.
- Gemergte PRs (30 T.)
- 199
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/servers
-
bug v2
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
modelcontextprotocol/servers#5483 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
modelcontextprotocol/servers#5482 ·
Maintainer antworten meist innerhalb von 1 Tag
-
chore dependencies server-filesystem v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
modelcontextprotocol/servers#5481 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
JaOffen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 1/100
modelcontextprotocol/servers#5484 ·
Maintainer antworten meist innerhalb von 1 Tag
-
chore v2
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
modelcontextprotocol/servers#5463 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/servers
Ähnliche Issues
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 86/100
ranxianglei/billion-context#5893 ·
Maintainer antworten meist innerhalb von 1 Tag
-
stringify escapes leading digits in pseudo-class arguments (:nth-child(1) becomes :nth-child(\31 ))Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement security severity:low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Battle-Cattle/BCUK-Bot-4#959 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug]: Claude account rows no longer show the email (since #8055), so "Account 1, 2, 3" cannot be told apartEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenaccount-pool bug gui
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
lidge-jun/opencodex#8286 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag