Skip to content

fix(inference): retry a CUDA OOM once, before any audio is sent - #562

Merged
remsky merged 2 commits into
remsky:masterfrom
davidcoulson:fix/oom-retry-once
Oct 28, 2026
Merged

remsky merged 2 commits into
remsky:masterfrom
davidcoulson:fix/oom-retry-once

Conversation

@davidcoulson

Copy link
Copy Markdown
Contributor

Both generate paths retried an out-of-memory error by calling themselves
again with no limit, then re-raised the original error even when the
retry succeeded. A chunk that never fits kept the GPU busy until the
recursion limit, and a failure after the first chunk replayed audio the
client already had. generate() also dropped return_timestamps on retry.

Retry once, only when nothing has been yielded, and return on success.

Testing

  • pytest: new tests, each confirmed to fail without the fix; full suite passes.
  • Not reproduced on CUDA: forcing an OOM on the 3070 wasn't practical, so the retry paths are covered by the unit tests only.
  • These were run on an RTX 3070 (Unraid, nvidia runtime) using an image built from docker/gpu/Dockerfile.optimized with this and six sibling PRs merged.

One of seven PRs from the same review. Each is based on master on its own; where they overlap (CHANGELOG [Unreleased], and kokoro_v1.py across the OOM, voice-mix and event-loop PRs), the conflicts are mechanical.

Both generate paths retried an out-of-memory error by calling themselves
again with no limit, then re-raised the original error even when the
retry succeeded. A chunk that never fits kept the GPU busy until the
recursion limit, and a failure after the first chunk replayed audio the
client already had. generate() also dropped return_timestamps on retry.

Retry once, only when nothing has been yielded, and return on success.
@remsky
remsky merged commit 6aa527c into remsky:master Oct 28, 2026
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