memory: two processes clearing one crash-left lock guard can remove a live guard
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 92k
- Fork
- 12k
- Merge trung bình
- 3 giờ 46 phút
- Pull request đã merge (30 ngày)
- 206
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/servers
-
`interface-diff` discards the git error when resolving its default base and reports the wrong causeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
modelcontextprotocol/servers#5636 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore server-memory v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
modelcontextprotocol/servers#5634 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation server-memory v2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
modelcontextprotocol/servers#5609 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug server-memory v2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
modelcontextprotocol/servers#5635 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement v2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
modelcontextprotocol/servers#5611 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/servers
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
hurttlocker/o8#6535 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: backend bug priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
snapotter-hq/SnapOtter#4856 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug follow-up
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
spellshift/realm#2509 ·
Maintainer thường phản hồi trong vòng 1 ngày