#1310
fix: InflightManager::enqueue leaks a duplicate close flag to the leader
The Entry::Vacant arm created two separate Arc close flags: one stored in the inflight table, another handed to the fetch leader. take() (called by insert()/cancellation) only flips the table's copy, so the leader's RawFetch::poll -- which reads its own copy -- never observes cancellation. A racing insert() of fresh bytes can be clobbered by the stale leader's re-insert of the value it already had in flight, since the leader is a detached spawned task that outlives any caller scope.
Share a single Arc between the table entry and the leader instead.
Activity
3Codecov Report
:x: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| foyer-memory/src/inflight.rs | 92.30% | 1 Missing :warning: |
| Files with missing lines | Coverage Δ | |
|---|---|---|
| foyer-memory/src/inflight.rs | 90.90% <92.30%> (+0.82%) | :arrow_up: |
... and 2 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Apologies — I didn't spot this before opening, but this fix is the same as #1289, which was there first (opened months ago). The core change to the
Entry::Vacantarm ininflight.rs(hoisting thecloseArcand cloning it into the table entry so the leader and table share one flag) is identical. Credit for the fix belongs to #1289.The only extra here is a small unit test in
inflight.rsasserting theLeadclose flag observestake()through the sharedArc, which complements #1289's end-to-end test inraw.rs. Happy to move that test over to #1289 and close this out.