Skip to content

An inference scheduler deadlocks under sustained load and stops issuing work

A continuous-batching scheduler admits requests against a token budget it must not exceed. Under sustained concurrency the accounting can reach a state where no admitted request can advance and no new one can be admitted, so the server stops issuing work while remaining connected and apparently healthy.

Quick answer

The scheduler is wedged, not overloaded. Lower the maximum batched token budget and the concurrent request limit so it runs with headroom, and alert on zero completions with a non-empty queue.

Symptom
assert total_num_tokens <= self.max_num_tokens, (
Root cause
Admission is a resource-allocation decision made repeatedly against a shared budget. If a request's demand can grow after it has been admitted, the scheduler can reach a state where the total exceeds what it promised itself, with every admitted request needing more budget to finish and none able to release any. That is a deadlock in the classical sense rather than an overload: no participant can proceed and none will yield.
Recommended fix
Reduce the maximum batched token budget so the scheduler operates with headroom rather than at its ceiling, which removes the tight contention the state requires.
How Denpex helps
Denpex investigates An inference scheduler deadlocks under sustained load and stops issuing work using the evidence you provide or your connected workload collects. Earlier rank, host or application evidence is needed to distinguish an initiating failure from a downstream report.
Performance#tensorrt-llm#scheduler#deadlock#in-flight-batching#token-budget#concurrency

What this failure is

A scheduling deadlock in a continuous-batching inference server where admitted requests collectively claim more of the token budget than it holds, leaving none able to progress and none able to release, so the server stops issuing work without failing.

Live diagnosis, no signup

Is this what broke your run? Paste your log.

You're reading about An inference scheduler deadlocks under sustained load and stops issuing work. Paste your own traceback and relevant evidence for an investigation of your workload, with a next action or a specific missing fact. A reference entry does not establish your cause. No account or card for the free diagnosis. Review data handling before submitting sensitive logs.

Before uploading, review cloud data handling and local options.

training_logs.txt
No log to hand? Try one:

Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.

3 free cloud diagnoses per day

Why it happens (the mechanism)

Continuous batching trades simplicity for utilisation: requests join and leave a running batch, and a shared budget decides who is admitted. Any admitted request whose demand can grow turns that budget from a bound into a claim, and claims that cannot be satisfied or withdrawn are the definition of deadlock. High concurrency is what makes the interleaving that reaches it likely.

What you'll observe

  • Throughput reaches zero while the process stays up and keeps accepting connections
  • It only appears above a certain request rate, so it never reproduces in a quiet environment
  • An assertion about token accounting fires, which reads as an internal bug rather than saturation
  • Restarting clears it until the load returns

Common symptoms and what they mean

Check possible explanations against the incident evidence. A matching symptom alone does not establish its cause.

SymptomPossible explanation
assert total_num_tokens <= self.max_num_tokens failing inside the engine's request-preparation pathAdmission is a resource-allocation decision made repeatedly against a shared budget. If a request's demand can grow after it has been admitted, the scheduler can reach a state where the total exceeds what it promised itself, with every admitted request needing more budget to finish and none able to release any.
[TRT-LLM] [E] Encountered an error in forward function, followed by an error in the event loop reporting that sampling failedThat is a deadlock in the classical sense rather than an overload: no participant can proceed and none will yield. It is why the server neither completes work nor sheds it, and why nothing times out on its own.
The reported total exceeding the configured maximum by a handful of tokens rather than by a large marginIt is load-dependent because the state requires a particular interleaving of admissions and completions. At low concurrency the budget is never contended tightly enough to reach it, which is why it survives testing and appears in production.
The overshoot varying between runs, sometimes a few tokens and occasionally by thousandsAdmission is a resource-allocation decision made repeatedly against a shared budget. If a request's demand can grow after it has been admitted, the scheduler can reach a state where the total exceeds what it promised itself, with every admitted request needing more budget to finish and none able to release any.
Disabling partial reuse making the failure arrive sooner rather than preventing itThat is a deadlock in the classical sense rather than an overload: no participant can proceed and none will yield. It is why the server neither completes work nor sheds it, and why nothing times out on its own.
An assertion comparing a running token total against the configured maximum, firing under loadIt is load-dependent because the state requires a particular interleaving of admissions and completions. At low concurrency the budget is never contended tightly enough to reach it, which is why it survives testing and appears in production.

Which systems are affected

  • Continuous and in-flight batching schedulers that admit against a global token budget
  • Deployments running near their configured maximum batched tokens rather than comfortably below it
  • Speculative decoding and other features that make a request's token demand vary during its lifetime
  • Long-context traffic, where a single request can consume a large share of the budget

How to confirm this is the problem

Use this checklist to test the hypothesis against a small reproduction. No single line proves the root cause, so preserve the preceding events and compare one variable at a time.

  • ✓Compare the reported total against the configured maximum. An overshoot of a few tokens points at the admission arithmetic rather than at a request that is genuinely too large.
  • ✓Raise the configured maximum and re-run the same traffic. Failing again at the new ceiling confirms the accounting rather than the value.
  • ✓Turn partial reuse off. Reaching the assertion sooner rather than later shows it is not the cause and rules out one variable.
  • ✓Check whether completions have stopped while the queue is non-empty; a wedged scheduler shows both at once, whereas an overloaded one still completes work slowly.
  • ✓Correlate onset with request rate rather than with any deployment change. A threshold that appears above a particular concurrency and not below it indicates a state reachable only under contention.
  • ✓Reduce the batched token budget and replay the same load. Surviving with a smaller ceiling confirms budget contention rather than a fault in any single request.

Root cause

  • Admission is a resource-allocation decision made repeatedly against a shared budget. If a request's demand can grow after it has been admitted, the scheduler can reach a state where the total exceeds what it promised itself, with every admitted request needing more budget to finish and none able to release any.
  • That is a deadlock in the classical sense rather than an overload: no participant can proceed and none will yield. It is why the server neither completes work nor sheds it, and why nothing times out on its own.
  • It is load-dependent because the state requires a particular interleaving of admissions and completions. At low concurrency the budget is never contended tightly enough to reach it, which is why it survives testing and appears in production.

The fix and how to prevent it

How to fix it

  • Reduce the maximum batched token budget so the scheduler operates with headroom rather than at its ceiling, which removes the tight contention the state requires.
  • Lower the concurrent request limit, which bounds how many claims can be outstanding against the budget at once.
  • Disable features that let an admitted request's token demand grow, such as speculative decoding, while establishing whether they are involved.
  • Cap the served context length to the workload's real maximum so no single request can claim a large fraction of the budget.
  • Restart to restore service once the accounting has wedged, since nothing in the scheduler will unwind the state on its own, and treat that as mitigation rather than a fix.

Step-by-step remediation

  1. 1Check whether completions have stopped entirely while the queue is non-empty.
  2. 2Establish whether onset tracks request rate rather than a deployment change.
  3. 3Reduce the maximum batched token budget and replay the same load.
  4. 4Reduce the concurrent request limit so fewer claims are outstanding at once.
  5. 5Alert on zero completions with a non-empty queue, since liveness will not catch this.

How to prevent it

  • Load-test at and beyond the intended peak concurrency, because the state is unreachable at low load and no amount of quiet running will find it.
  • Alert on zero completions with a non-empty queue, which detects a wedged scheduler that every liveness and readiness check will call healthy.
  • Leave deliberate headroom between the configured budget and the peak observed demand rather than tuning to the edge for throughput.

Save this diagnosis and catch the next crash automatically

All root cause, fix, and prevention steps above are free to read. Create a free account with any email or GitHub to keep your saved diagnosis history across the encyclopedia and run cloud checks, or use a work email below for the 30-day Team evaluation. No card required.

Or start a 30-day free Team trial (work email)

Verified work email unlocks all 14 fleet diagnostic tools, Slack alerts, and team history for 30 days. No card and no automatic charge.

Use your company email, for example alex@yourcompany.com.

Who qualifies?

Company email domains activate the free 30-day Team evaluation (up to 50 diagnoses a day) after an email and domain check, whatever mail provider you use. If we cannot verify your domain automatically, support reviews it: write to support@denpex.com. Free local diagnosis in the editor extension needs no account.

Using a personal email (Gmail, Outlook, Naver, QQ) or solo cluster? Create a free $0 account (no work email required) to save 7-day history and unlock AI fallback, or send a cluster crash log for a live walkthrough.
Already have an account? Sign in

Searchable error signature

search key
    assert total_num_tokens <= self.max_num_tokens, (
[TRT-LLM] [E] Encountered an error in forward function:
[TRT-LLM] [E] Error in event loop: Sampling failed
total_num_tokens=4118 > 4096
  File ".../model_engine.py", line 2678
AssertionError: assert total_num_tokens <= self.max_num_tokens
[TRT-LLM] [E] Encountered an error in forward function
[TRT-LLM] [E] Error in event loop

Use this text as a lookup key in logs and upstream issue trackers. It is not presented as a captured customer log. Confirm the cause from your own preceding events, versions, configuration and the cited references.

Diagnose your own log automatically

The root cause and fix steps above stay free. Create a free account to analyze full job logs, attribute the first failed rank, and keep saved incident history.

Sign up free. Analyze your cluster logs

No credit card. Daily allowance follows verified trust tier. Instant access.

Why the recommended fix works

Operating below the ceiling means an admitted request's growth can be absorbed rather than contended, so the state is never reached. Reducing concurrency does the same from the other side by limiting how many claims exist at once. Neither improves peak throughput on paper, and both are what keep the measured throughput above zero.

Best practices by model family

Model / StackRecommendationNotes
Wedged under peak loadLower the maximum batched token budgetRemoves the tight contention the deadlock state requires.
High concurrency trafficLower the concurrent request limitBounds how many outstanding claims exist against the budget.
Speculative decoding enabledDisable it while diagnosingIt lets an admitted request's demand grow after admission.
Any production poolAlert on zero completions with a non-empty queueLiveness and readiness both pass while the server does nothing.

With the fix vs without the fix

DimensionWith the fixWithout the fix
Overloaded versus wedgedWedged completes nothing at allAssumed to be slow rather than stopped
What health checks reportHealthy, because the process answersExpected to fail and evict the instance
Effect of restartingRestores service until load returnsTaken as evidence the problem is fixed

Diagnostic note

“Every health check will report this instance as fine. The process is running, the port answers, and readiness passes, so an orchestrator keeps routing to a server that completes nothing. If you take one thing from this entry, make it the alert on completions rather than on liveness, that gap is what turns a scheduler bug into a silent outage across a whole pool.”

Visual fingerprint

Claims that cannot be satisfied or withdrawn
  budget: max_num_tokens
    admitted A  needs more to finish  ---+
    admitted B  needs more to finish  ---+--> total > budget
    admitted C  needs more to finish  ---+

    none can complete    -> none releases budget
    none can be admitted -> queue grows, completions = 0
Each admitted request needs more of the token budget to finish, and none can release any until it does. The total exceeds what the scheduler promised itself, so no request advances and no new request is admitted while the queue keeps growing.

Diagnose this failure in VS Code

Select the traceback or open the failed terminal, then run Denpex locally to inspect matched failure patterns, supporting evidence and next checks without uploading the log. Verify recommendations against your workload before changing production.

Install the free VS Code extension

Frequently asked questions

Questions engineers and on-call staff commonly ask about this failure.

Is the server just overloaded?
An overloaded server still completes work, slowly. This one completes nothing while the queue grows, which is a deadlock rather than saturation.
Why do health checks pass?
The process is running and the port answers. Nothing in a liveness or readiness probe measures whether requests are completing.
It only happens in production.
The state needs a particular interleaving of admissions and completions under contention, which low-concurrency testing never produces.
Restarting fixes it. Is that enough?
It restores service and nothing more. The state will be reached again at the same load unless the budget or the concurrency limit is reduced.

Don't just read the fix, diagnose your run

The encyclopedia explains documented failure patterns. Denpex investigates your logs, configuration and stack, shows the supporting evidence, and asks for missing details when needed.