[Bugfix] Fix write-through events not processed when scheduler is idle#20560
Merged
hnyls2002 merged 1 commit intosgl-project:mainfrom Mar 17, 2026
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Collaborator
|
/tag-and-rerun-ci |
Wangzheee
pushed a commit
to Wangzheee/sglang
that referenced
this pull request
Mar 21, 2026
0-693
pushed a commit
to 0-693/sglang
that referenced
this pull request
Mar 25, 2026
KHAEntertainment
pushed a commit
to Clarit-AI/Engram
that referenced
this pull request
Mar 31, 2026
JustinTong0323
pushed a commit
to JustinTong0323/sglang
that referenced
this pull request
Apr 7, 2026
yhyang201
pushed a commit
to yhyang201/sglang
that referenced
this pull request
Apr 22, 2026
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.
Motivation
I am developing CXL memory-based KV cache sharing (Maru). HiCache's 3-tier hierarchy (L1 GPU → L2 Host → L3 Storage) is a great fit for this, so I integrated it as an L3 backend and started validation testing.
During KV sharing tests between two SGLang instances, I found that write-through completions are never flushed to L3 storage while the scheduler is idle.
check_hicache_events()is called inside_get_new_batch_prefill_raw()after an early return that fires whenwaiting_queueis empty. During idle periods, the method returns before reachingcheck_hicache_events(), so the write-through pipeline (GPU→Host→L3) never completes and the other instance sees zero cache hits.This bug affects all HiCache L3 backends (not just Maru) when using write-through policy.
Modifications
Move
check_hicache_events()call before the early-return condition in_get_new_batch_prefill_raw(), so write-through completions and prefetch events are processed on every scheduler tick regardless of whether new prefill work is available.Checklist