memory: clean up active lock files on exit and termination signals
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 25/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Estagnada
- Stack de tecnologia
- docker, node.js, typescript
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 91.7k
- Forks
- 11.9k
- Merge médio
- 3h 30min
- PRs com merge (30d)
- 199
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de modelcontextprotocol/servers
-
fix(docker): correct stale --db-path comments in fetch/git Dockerfiles and clarify git READMEAbertabug v2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
modelcontextprotocol/servers#5483 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
bug v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
modelcontextprotocol/servers#5482 ·
Mantenedores costumam responder em até 1 dia
-
chore dependencies server-filesystem v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
modelcontextprotocol/servers#5481 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 Meio dia Facilidade para iniciantes 25/100
modelcontextprotocol/servers#5486 ·
Mantenedores costumam responder em até 1 dia
-
JaAberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 1/100
modelcontextprotocol/servers#5484 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/servers
Issues semelhantes
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
danielw-sudo/agentuto#63 ·
Mantenedores costumam responder em até 1 dia
-
idea-scout idea:341
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
jeanibarz/agent-notebook#341 ·
Mantenedores costumam responder em até 1 dia
-
documentation good first issue roadmap
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
type:bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
nightgauge/nightgauge#3077 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
LibreChat-AI/LibreChat#17915 ·
Mantenedores costumam responder em até 1 dia