Skip to content

[fix] Fix writer lock deadlock in update_weights_from_ipc during pause_generation - #22290

Merged
hnyls2002 merged 2 commits into
sgl-project:mainfrom
maocheng23:fix/pause-generation-writer-lock-deadlock-main
Apr 8, 2026
Merged

[fix] Fix writer lock deadlock in update_weights_from_ipc during pause_generation#22290
hnyls2002 merged 2 commits into
sgl-project:mainfrom
maocheng23:fix/pause-generation-writer-lock-deadlock-main

Conversation

@maocheng23

Copy link
Copy Markdown
Collaborator

Summary

  • Fix writer lock deadlock in update_weights_from_ipc when scheduler is in pause_generation mode
  • When the scheduler is paused, existing readers are blocked on is_pause_cond, so acquiring the writer lock would deadlock. This change skips the writer lock when paused (using nullcontext()) since no concurrent inference can race in that state.
  • Port of Fix deadlock for in_place/retract in pause_generation #22211 to main branch (only the deadlock fix, single file change)

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

…e_generation

When the scheduler is paused, existing readers are blocked on
is_pause_cond, so acquiring the writer lock would deadlock. Skip the
writer lock when paused (using nullcontext()) since no concurrent
inference can race in that state.

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!

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

Copy link
Copy Markdown
Collaborator

/rerun-test test_scheduler_pause_generation.py test_pause_generation_tensor_consistency.py test_update_weights_from_tensor.py test_update_weights_from_distributed.py

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

ubuntu-latest (2 tests): View workflow run

cd test/ && python3 registered/unit/managers/test_scheduler_pause_generation.py
cd test/ && python3 registered/rl/test_pause_generation_tensor_consistency.py

1-gpu-5090 (1 test): View workflow run

cd test/ && python3 registered/rl/test_update_weights_from_tensor.py

2-gpu-h100 (1 test): View workflow run

cd test/ && python3 registered/rl/test_update_weights_from_distributed.py

@hnyls2002
hnyls2002 merged commit 6c2a759 into sgl-project:main Apr 8, 2026
55 of 63 checks passed
carlosfundora pushed a commit to carlosfundora/sglang-1-bit-turbo that referenced this pull request Apr 8, 2026
…s_from_ipc during pause_generation (sgl-project#22290)

Upstream SHA: 6c2a759
Cherry-picked from sgl-project/sglang

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
caitengwei pushed a commit to caitengwei/sglang that referenced this pull request Jun 1, 2026
…e_generation (sgl-project#22290)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
…e_generation (sgl-project#22290)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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