Repository navigation
fix(daemon,pool): registry writes keep an entry they meet mid-replace; tend reads leases under the lock - #545
Merged
Merged
Conversation
…; tend reads leases under the lock Findings of the code review of v0.47.0..725e9d2 (documented internally): - The registry's write path (`read_raw` in `change`, `read_in` in `set_claims`) read once: a write that met its entry while another daemon replaced it wrote back only the field it set, and the stack dropped out of `list` with its claims. One reader (`read_json`) now serves `list`, `read_in` and `read_raw`; `change` does not write over an entry that is there and does not read. - That reader retries I/O errors and cut-off JSON only; content that reads and does not parse is given up at once, so a broken file no longer costs every `list` 200 ms. - `free_range_for` reads the registry and probes ports without holding `known`; it takes the number under the lock, and looks again if another start took it meanwhile. - `tend` reads the leases and the waits under the machines' lock, right before it decides whether a machine is idle. - `range_taken` keeps asking what listens on the services' ports only: the lane's own containers may still hold its containers' ports at that point (said at the function). Bug-Class: stale-snapshot Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Findings of the code review of
v0.47.0..725e9d2in the daemon and the pool coordinator (the review is documented internally; the dashboard and hub findings are a PR of their own).read_raw,read_in): a write that met its entry mid-replace wrote back only what it set; the stack dropped out oflistwith its claimsread_jsonforlist,read_in,read_raw;changedoes not write over an entry that is there and does not reada_write_keeps_the_entry_it_met_while_it_was_replaced: red before (claims lost), green afterlistan_entry_that_is_no_entry_is_given_up_at_once: red before (> 100 ms), green afterfree_range_forheldknownover registry reads and port probeslane_renumberedin the logtendcopied leases and waits before the machines' lockrange_takenasks what listens on services' ports onlylaunch_remotestops them after the check); said at the functionChecks
cargo fmt --check,cargo clippy --workspace --all-targets --locked -D warnings,cargo test -p devstack-daemon(214),cargo test -p devstack-node(lib 115, provision 5, three runs).Bug class:
stale-snapshot.🤖 Generated with Claude Code