fix(core): Resolve PagedAttention VRAM leak and scheduler deadlock during OOM#2045
Open
glaziermag wants to merge 1 commit intoEricLBuehler:masterfrom
Open
fix(core): Resolve PagedAttention VRAM leak and scheduler deadlock during OOM#2045glaziermag wants to merge 1 commit intoEricLBuehler:masterfrom
glaziermag wants to merge 1 commit intoEricLBuehler:masterfrom
Conversation
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.
Fixes the primary underlying cause of PagedAttention scheduler freeze under VRAM exhaustion / generic pipeline faults.
The Problem
During OOM memory stress or other GPU kernel panics (e.g.,
shape mismatch), the engine becomes permanently frozen. The scheduler continues to report full VRAM capacity and rejects incoming requests (16 running, 112 waiting).This occurs because:
handle_pipeline_forward_error!directly catches exceptions and transmits the error back to the client.continue 'lp;, violating the pipeline invariant and forcefully jumping past the bottom of the main engine loop block.scheduler.free_finished_sequence_groups()instantiated natively atmod.rs:837. Aborted sequences remain in the cache until restart.The Solution
SequenceState::Errorexplicitly tois_finished_paged_attn().seq.responder().send(...)to bypass defunct TCP clients abandoning the session during memory starvation.get_mut_arcmutex!($scheduler).free_finished_sequence_groups()strictly into the runtime ofhandle_pipeline_forward_error!directly prior to the loop branch jump, restoring the clean cleanup flow.Native Empirical Proof
Before Patch: Engine Freezes at First Fault
After Patch: Zero-Side-Effect Graceful Eviction
Tested with 128 extreme concurrent curl contexts simulating generic kernel blowout. Note the exact immediate wait decrement and 21.80 unaffected throughput flow.
Reproducibility & Environment
These native deadlock traces and recovery metrics were physically tested and verified on the following hardware platform according to continuous integration standards:
g2-standard-32--features cudamistralai/Mistral-7B-Instruct-v0.1