memory: two processes clearing one crash-left lock guard can remove a live guard
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 42/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- node.js, typescript
Direção de pesquisa
Start with isGuardHeld in src/memory/index.ts and the existing lock tests; trace how stale guards are judged and removed by path. The approach is undecided, so first compare it with breakStaleLock and define the remaining race before choosing a fix. Done means a deterministic test shows a fresh guard survives when two processes clear the same crash-left guard, and the existing lock tests pass.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Problem
The memory server's cross-process lock uses a second exclusive-create file, the guard (<memory file>.lock.break), to order stale-lock breaking and, since #5565 (PR #5623), every release and every newly created lock's confirmation. A guard left behind by a process that crashed while holding it is cleared by whoever finds it older than the stale timeout (30 seconds by default).
That clearing is done by path: the finder opens the guard, judges its age through the handle, and then calls unlink on the guard's path (isGuardHeld in src/memory/index.ts; before #5565 the same stat then unlink in breakStaleLock). Two processes clearing the same crash-left guard at once can therefore remove a live one:
- A and B both open the crash-left guard and judge it stale.
- A unlinks it.
- C (a releasing holder, or a breaker) creates a fresh guard at the same path.
- B unlinks the path, deleting C's fresh guard.
C then runs its few guarded file-system calls unguarded, so a breaker can act between a release's token comparison and its removal (the third window of #5565), or two breakers can run at once.
It takes a crash inside a guarded section (a few file-system calls per write), then two processes clearing that guard within the same moment, then a third taking the guard between their two unlinks. The processes run as the same user, so this is a correctness gap, not a security boundary. Raised by Copilot in review of #5623 and declined there as beyond the three windows #5565 names.
Expected behavior
Clearing a guard left by a crash never removes a guard another process has taken since.
Approach
To be decided. Renaming the guard aside and comparing device and inode with the judged file before deleting it, as breakStaleLock does for the lock itself (#5560), removes exactly this interleaving, but putting a mistakenly taken live guard back has its own gap one level down (a create at the guard path while it is aside). Whatever is chosen should say what remains, as the comment above guardPathOf() does today.
Acceptance criteria
- A deterministic test (no timing dependence): two clearers of one crash-left guard, with a fresh guard created between their removals; the fresh guard survives.
- The existing lock tests still pass.
- Linguagem predominante
- TypeScript
- Estrelas
- 92k
- Forks
- 12k
- Merge médio
- 3h 46min
- PRs com merge (30d)
- 206
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
-
`interface-diff` discards the git error when resolving its default base and reports the wrong causeAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
modelcontextprotocol/servers#5636 ·
Mantenedores costumam responder em até 1 dia
-
chore server-memory v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
modelcontextprotocol/servers#5634 ·
Mantenedores costumam responder em até 1 dia
-
documentation server-memory v2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
modelcontextprotocol/servers#5609 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug server-memory v2
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
modelcontextprotocol/servers#5635 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
enhancement v2
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
modelcontextprotocol/servers#5611 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/servers
Issues semelhantes
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
elastic/kibana#306401 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
agentes-chat/agentes-chat#927 ·
Mantenedores costumam responder em até 1 dia
-
[Bug]: Webapp workspace fails to render in Safari — "Can't find variable: requestIdleCallback"Abertacomp/desktop P2 type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
NousResearch/hermes-agent#157702 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
e2e-failure ready-to-code
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
redhat-developer/rhdh-plugin-export-overlays#4794 · 1 comentário ·
Mantenedores costumam responder em até 1 dia