Repository navigation
fix(exl3): make slot assignment atomic across processes - #3714
Merged
Merged
Conversation
Collaborator
Author
|
Reviewed: successful assignment publication left a hidden hard link. Reproduced it and opened #3784; the fix removes the temporary name and passes the remote-client tests. |
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.
TL;DR
Make EXL3 assignment publication atomic and add cross-process slot ownership. Concurrent coordinators can no longer overwrite one assignment record or simultaneously lease the same physical coordinator slot.
1. The problem
The old flow checked
path.exists()and then usedos.replace(). Two coordinators could both pass the check and overwrite each other. Even after assignment publication, slot busy counts were process-local.os.replace(temporary_name, path)in_persist_assignmentself._busy_slotsonlynew_assignment=Trueflowchart TD A["coordinator A sees no assignment"] --> C["os.replace"] B["coordinator B sees no assignment"] --> C C --> D["one file overwrites the other"] D --> E["both use process-local busy counts"] E --> X["same physical slot leased twice"] style X fill:#fee,stroke:#b222. The new flow
flowchart TD A["acquire_slot"] --> B{"assignment in local state"} B -->|"yes"| H{"local capacity available"} B -->|"no"| C["select available slot"] C --> D["_persist_assignment"] D -->|"os.link succeeds"| E["record new_assignment"] D -->|"FileExistsError"| G["_read_assignment"] G -->|"missing or invalid"| X["fail closed"] E --> H G --> H H -->|"no"| I["condition wait"] H -->|"yes"| J["_acquire_cross_process_slot"] J -->|"lock unavailable"| K["timed condition wait"] K --> H J -->|"lock acquired"| L["return ExecutionSlotLease"] L --> M["release local count and FileLock"] style X fill:#fee,stroke:#b22The same flow and before/after table are committed in
docs/exl3-remote-workers.md.3. Failure contract
FileExistsError, then authoritative reread and validationRuntimeErrorValueErrorFileLockboth released4. Tests
test_assignment_publication_is_exclusive_and_resumes_authoritative_slottest_coordinator_slot_lock_is_exclusive_across_processesValidation
The deselected test requires a CUDA JIT build; this host has no
CUDA_HOME, so the failure is an environment limitation unrelated to this change.