Skip to content

feat(tts): kokoro-fastapi v0.6.0 + memory cap (fixes demo RSS leak) - #49

Merged
genwave-radio merged 1 commit into
mainfrom
feat/kokoro-v0.6.0
Jul 19, 2026
Merged

feat(tts): kokoro-fastapi v0.6.0 + memory cap (fixes demo RSS leak)#49
genwave-radio merged 1 commit into
mainfrom
feat/kokoro-v0.6.0

Conversation

@genwave-radio

Copy link
Copy Markdown
Collaborator

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

  • Pin bump v0.2.1v0.6.0 in compose.yaml and the Host.Tests kokoro fixture.
  • mem_limit: 3g on 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 and restart: unless-stopped revives 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.
  • ⚠️ Breaking wire change absorbed: v0.6.0 changed GET /v1/audio/voices from {"voices": ["af_heart", ...]} to {"voices": [{"id": "af_heart", "name": "af_heart"}, ...]} (and 67 → 68 voices). The old KokoroVoicesResponse (List<string>) would have thrown on it. It now holds raw JsonElements and flattens either generation to the id list — Tts:Endpoint is operator-repointable at runtime (F36.4), so both shapes must keep parsing.
  • New wire-shape specs (Story097_KokoroVoicesWireShapes) pin both generations using JSON captured from the real v0.6.0 container, plus degenerate-entry sad paths.
  • The four acceptance-gate ComposeYamlSha256 pins re-pinned with the house-convention dated comment.

✅ Verification

  • Real kokoro-fastapi-cpu:v0.6.0 container: /v1/audio/voices (68 voices) and /v1/audio/speech → valid 24kHz mono WAV
  • dotnet build — 0 warnings; full non-integration suite green (Core 97, Orchestration 56, MediaLibrary 38, Tts 126, Host 684)
  • Real-kokoro integration suite (LevelMatchingRealKokoro, 7 tests) green against the bumped fixture image

🚀 Deploy note (demo box)

After merge: docker compose pull kokoro && docker compose up -d kokoroup -d applies the new mem_limit too.

🤖 Generated with Claude Code

…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>
@genwave-radio
genwave-radio merged commit 4d648f3 into main Jul 19, 2026
9 checks passed
@genwave-radio
genwave-radio deleted the feat/kokoro-v0.6.0 branch July 19, 2026 13:45
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant