fix(shim): hold registry lock across load-modify-save to prevent pane ID races#640
Open
fix(shim): hold registry lock across load-modify-save to prevent pane ID races#640
Conversation
… ID races state::load() and state::save() each acquired independent flocks. Between the two calls, a concurrent split-window could read the same next_pane_id, causing duplicate pane IDs and orphaned daemon PTYs. Add LockedRegistry guard type that holds both the Flock and PaneRegistry. save(self) writes while the lock is still held. Update all 8 callers in commands.rs to use load_and_lock() + locked.save(). Add thread-level concurrency test verifying unique pane ID allocation.
Owner
Author
PR Review SummaryCritical Issues (1 found)
Important Issues (1 found)
Suggestions (3 found)
Strengths
Documentation Issues
Test Coverage
Error Handling
VerdictNEEDS FIX -- The clippy dead-code error on Recommended Actions
|
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.
Summary
LockedRegistryguard type instate.rsholding bothFlock<File>andPaneRegistryload_and_lock()acquires exclusive flock + reads registry atomically, returns guardsave(self)writes while lock is still held, then consumes guard (lock drops)commands.rs:handle_split_window,handle_kill_pane,handle_select_pane,handle_set_option,handle_new_session,handle_new_window,handle_break_pane,handle_join_paneTest plan
cargo fmt --checkpassescargo clippy --all -- -D warningspassescargo test -p kild-tmux-shimpasses (including new concurrency test)cargo build --allpasses