feat(tts): kokoro-fastapi v0.6.0 + memory cap (fixes demo RSS leak) - #49
Merged
Conversation
…ream RSS leak The demo appliance's kokoro container leaked to ~6GB RSS (upstream remsky/Kokoro-FastAPI#453 — per-request voice tensor round-trip; root cause fixed after v0.2.x). Bump the pin to v0.6.0 in compose.yaml and the Host.Tests fixture, and add mem_limit: 3g (fresh baseline ~1.2GiB) as a fail-closed backstop: leak past the cap -> OOM-kill -> restart: unless-stopped revives it clean. Blast radius is one failed TTS render; the broadcast plays on. v0.6.0 changed the /v1/audio/voices wire shape from ["id", ...] to [{"id": ..., "name": ...}, ...]: KokoroVoicesResponse now holds raw JsonElements and flattens EITHER generation to the id list (Tts:Endpoint is operator-repointable at runtime, so both shapes must parse). New wire-shape specs pin both, from JSON captured off the real v0.6.0 container. Acceptance-gate compose.yaml hash pins re-pinned per house convention. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 demo appliance's kokoro memory leak (observed at ~6GB RSS, "LLM" indicator red, resolved by container restart).
🔍 Root cause
Upstream remsky/Kokoro-FastAPI#453: every TTS request did a full voice-tensor load → deserialize → re-serialize → temp-file round-trip, leaking ~20–30MB/request plus orphaned temp files. Closed 2026-05-09; we were pinned to v0.2.1 (pre-fix).
📦 Changes
v0.2.1→v0.6.0incompose.yamland the Host.Tests kokoro fixture.mem_limit: 3gon the kokoro service (fresh v0.6.0 baseline is ~1.2GiB). Fail-closed backstop: if anything leaks past the cap, the kernel OOM-kills the container andrestart: unless-stoppedrevives it clean in seconds — condition-triggered, no cron. Blast radius is one failed TTS render; the orchestrator plays music without patter meanwhile — never-silent holds.GET /v1/audio/voicesfrom{"voices": ["af_heart", ...]}to{"voices": [{"id": "af_heart", "name": "af_heart"}, ...]}(and 67 → 68 voices). The oldKokoroVoicesResponse(List<string>) would have thrown on it. It now holds rawJsonElements and flattens either generation to the id list —Tts:Endpointis operator-repointable at runtime (F36.4), so both shapes must keep parsing.Story097_KokoroVoicesWireShapes) pin both generations using JSON captured from the real v0.6.0 container, plus degenerate-entry sad paths.ComposeYamlSha256pins re-pinned with the house-convention dated comment.✅ Verification
kokoro-fastapi-cpu:v0.6.0container:/v1/audio/voices(68 voices) and/v1/audio/speech→ valid 24kHz mono WAVdotnet build— 0 warnings; full non-integration suite green (Core 97, Orchestration 56, MediaLibrary 38, Tts 126, Host 684)LevelMatchingRealKokoro, 7 tests) green against the bumped fixture image🚀 Deploy note (demo box)
After merge:
docker compose pull kokoro && docker compose up -d kokoro—up -dapplies the newmem_limittoo.🤖 Generated with Claude Code