Repository navigation
fix(minimald): a kept session leaves the tearing-down set before the cleanup's answer - #2505
Conversation
…cleanup's answer The conditional destroy answered its caller from inside the teardown task, whose drop guard took the session out of the tearing-down set only when the task ended. A caller that read the record or the listing on the reply could still find a kept session hidden behind the set, which is what a_cleanup_destroy_keeps_a_finished_session hit in a merge group under load. The guard is dropped before the answer goes out.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Reviewed: no findings; approval withheld, 1 thread unresolved at APPROVE withheld: 1 unresolved thread — minimal-foundry[bot] crates/minimald/src/box_manager.rs:1718. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Clobber: none. |
| } | ||
| .await; | ||
| // Out of the set before the answer goes out: a | ||
| // caller that reads the record or the listing on | ||
| // the reply must not find a kept session still | ||
| // hidden behind the set. | ||
| drop(release); | ||
| r.handle(async { answer }).await; |
There was a problem hiding this comment.
LOW · tests · confidence 0.55 · in BoxManager
The fix closes a timing race, but the diff adds no test that fails without it. The existing a_cleanup_destroy_keeps_a_finished_session is the flaky test and only fails under load. A test can pause the reply with a gated reply channel and assert that get_record finds the kept session at that point. Also note the destroyed answer now leaves the set before the reply, so a second destroy can reach a not-yet-evicted actor. Check that the actor evicts itself before it answers.
What the reviewer checked
drop(release);
r.handle(async { answer }).await;
Hand this to an agent
Act on a code-review finding.
File: crates/minimald/src/box_manager.rs
Lines: 1711-1718
Category: tests
Severity: low (reviewer confidence 0.55)
Finding:
The fix closes a timing race, but the diff adds no test that fails without it. The existing `a_cleanup_destroy_keeps_a_finished_session` is the flaky test and only fails under load. A test can pause the reply with a gated reply channel and assert that `get_record` finds the kept session at that point. Also note the destroyed answer now leaves the set before the reply, so a second destroy can reach a not-yet-evicted actor. Check that the actor evicts itself before it answers.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
a_cleanup_destroy_keeps_a_finished_sessionfailed in #2226's merge group this afternoon: the cleanup destroy answered "kept", and the record read on the reply found nothing. The conditional destroy (#2233) answers its caller from inside the teardown task, and the task's drop guard takes the session out of the tearing-down set only when the task ends, so for a moment after the reply a kept session is still hidden behind the set, whichget_recordandlisthonour. On the box the test passes 5/5 alone; under a loaded runner the window is real.One change: the guard is dropped before the answer goes out, so a caller that reads on the reply sees the kept session. The cleanup tests, the teardown tests and the listing tests pass three runs over.
🤖 Generated with Claude Code
Summary by CodeRabbit