Skip to content

[fix] Fix deadlock and TOCTOU race in pause-aware weight update locking - #22754

Merged
yueming-yuan merged 1 commit into
sgl-project:sglang-milesfrom
maocheng23:fix/pause-generation-toctou-miles
Apr 14, 2026
Merged

[fix] Fix deadlock and TOCTOU race in pause-aware weight update locking#22754
yueming-yuan merged 1 commit into
sgl-project:sglang-milesfrom
maocheng23:fix/pause-generation-toctou-miles

Conversation

@maocheng23

@maocheng23 maocheng23 commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix writer lock deadlock in update_weights_from_ipc and post_process_weights during pause_generation mode
  • Fix TOCTOU (time-of-check to time-of-use) race in all four weight update paths: update_weights_from_distributed, update_weights_from_tensor, update_weights_from_ipc, post_process_weights
  • When paused, hold is_pause_cond during the weight update so resume_generation cannot race between the check and the update. When not paused, acquire the writer lock as before.
  • Remove now-unused nullcontext import
  • Combines Fix deadlock for in_place/retract in pause_generation #22211 (deadlock fix) and [tiny] Fix TOCTOU race in pause-aware weight update locking #22304 (TOCTOU fix) into a single clean commit on sglang-miles-v0.5.10

Test plan

  • Verify IPC weight update completes without deadlock when scheduler is paused
  • Verify normal (non-paused) weight updates still acquire the writer lock correctly
  • Run existing e2e tests to confirm no regression

🤖 Generated with Claude Code

Fix writer lock deadlock in update_weights_from_ipc and
post_process_weights during pause_generation, and close a TOCTOU race
in all four weight update paths (update_weights_from_distributed,
update_weights_from_tensor, update_weights_from_ipc, post_process_weights).

When paused, hold is_pause_cond during the weight update so
resume_generation cannot race between the check and the update.
When not paused, acquire the writer lock as before.

Combines sgl-project#22211 (deadlock fix) and sgl-project#22304 (TOCTOU fix).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@yueming-yuan
yueming-yuan merged commit 8f874d1 into sgl-project:sglang-miles Apr 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants