[GH-ISSUE #1987] [Issue]: Issue-Report (English) — 60 s TTS timeout #972

Closed
opened 2026-10-21 05:24:20 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @GerdW on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1987

Originally assigned to: @cha1latte on GitHub.

Issue-Report (English) — 60 s TTS timeout

Summary

The server-side TTS proxy (POST /api/tts/speak) hard-codes a 60-second request timeout (AbortSignal.timeout(60_000)), with no environment variable or setting to change it. Self-hosted, OpenAI-compatible TTS backends that are slower than real-time (e.g. voice-cloning models at RTF ≈ 2–3) exceed 60s even for a single chunk and fail with a 502, making higher-quality local TTS effectively unusable.

Expected behavior

The TTS request timeout should be configurable (e.g. a TTS_REQUEST_TIMEOUT_MS environment variable, or a per-connection setting), so users running slower self-hosted TTS providers can raise it to match their backend's generation time.

Actual behavior

The timeout is fixed at 60,000 ms in code and cannot be overridden. When a single TTS chunk takes longer than 60s to synthesize, the provider fetch aborts and the endpoint returns 502 { "error": "TTS request timed out" }. Client-side sentence/length chunking (~900 chars per request) does not prevent this, because a single chunk on a slow backend can still exceed 60s.

Steps to reproduce

  1. Configure a TTS connection (Source: OpenAI-compatible) pointing at a self-hosted TTS server whose synthesis is slower than real-time (e.g. a voice-cloning model at RTF ≈ 2–3).
  2. Trigger TTS playback on an assistant message that produces a chunk requiring more than 60s of synthesis time.
  3. Observe the request abort at exactly ~60s; the UI surfaces a TTS error and no audio plays.

Environment

  • Marinara Engine version: 1.6.1
  • Install type: source (git checkout, run as a systemd service)
  • OS + version: Debian-based Linux (Proxmox LXC)
  • Browser or app shell: Desktop browser (PWA)

Logs, screenshots, or video

TTS provider request failed: TimeoutError
POST /api/tts/speak -> 502 { "error": "TTS request timed out" }

(Server log shows a TimeoutError exactly 60s after the request is issued.)

Additional context

  • Source location: packages/server/src/routes/tts.routes.ts, in the POST /api/tts/speak handler — signal: AbortSignal.timeout(60_000) on the provider safeFetch. The value is a literal constant; there is no env/config override.
  • The 60s limit applies per chunk, not per message. The client (packages/client/src/lib/tts-dialogue.ts, DEFAULT_TTS_CHUNK_CHAR_LIMIT = 900) already splits text into chunks sent as separate /api/tts/speak requests, but the per-chunk ceiling still blocks slow backends.
  • Suggested fix: read the timeout from an env var (e.g. TTS_REQUEST_TIMEOUT_MS, default 60000) and/or expose it as a per-connection setting. Optionally make DEFAULT_TTS_CHUNK_CHAR_LIMIT configurable so users can trade smaller chunks for staying under the timeout.
  • Affected setups: self-hosted OpenAI-compatible TTS (e.g. LocalAI, custom bridges) using cloning/expressive models where RTF > ~0.7.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @GerdW on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1987 Originally assigned to: @cha1latte on GitHub. Issue-Report (English) — 60 s TTS timeout ## Summary The server-side TTS proxy (`POST /api/tts/speak`) hard-codes a 60-second request timeout (`AbortSignal.timeout(60_000)`), with no environment variable or setting to change it. Self-hosted, OpenAI-compatible TTS backends that are slower than real-time (e.g. voice-cloning models at RTF ≈ 2–3) exceed 60s even for a single chunk and fail with a 502, making higher-quality local TTS effectively unusable. ## Expected behavior The TTS request timeout should be configurable (e.g. a `TTS_REQUEST_TIMEOUT_MS` environment variable, or a per-connection setting), so users running slower self-hosted TTS providers can raise it to match their backend's generation time. ## Actual behavior The timeout is fixed at 60,000 ms in code and cannot be overridden. When a single TTS chunk takes longer than 60s to synthesize, the provider fetch aborts and the endpoint returns `502 { "error": "TTS request timed out" }`. Client-side sentence/length chunking (~900 chars per request) does not prevent this, because a single chunk on a slow backend can still exceed 60s. ## Steps to reproduce 1. Configure a TTS connection (Source: OpenAI-compatible) pointing at a self-hosted TTS server whose synthesis is slower than real-time (e.g. a voice-cloning model at RTF ≈ 2–3). 2. Trigger TTS playback on an assistant message that produces a chunk requiring more than 60s of synthesis time. 3. Observe the request abort at exactly ~60s; the UI surfaces a TTS error and no audio plays. ## Environment - Marinara Engine version: 1.6.1 - Install type: source (git checkout, run as a systemd service) - OS + version: Debian-based Linux (Proxmox LXC) - Browser or app shell: Desktop browser (PWA) ## Logs, screenshots, or video TTS provider request failed: TimeoutError POST /api/tts/speak -> 502 { "error": "TTS request timed out" } (Server log shows a `TimeoutError` exactly 60s after the request is issued.) ## Additional context - Source location: `packages/server/src/routes/tts.routes.ts`, in the `POST /api/tts/speak` handler — `signal: AbortSignal.timeout(60_000)` on the provider `safeFetch`. The value is a literal constant; there is no env/config override. - The 60s limit applies per chunk, not per message. The client (`packages/client/src/lib/tts-dialogue.ts`, `DEFAULT_TTS_CHUNK_CHAR_LIMIT = 900`) already splits text into chunks sent as separate `/api/tts/speak` requests, but the per-chunk ceiling still blocks slow backends. - Suggested fix: read the timeout from an env var (e.g. `TTS_REQUEST_TIMEOUT_MS`, default 60000) and/or expose it as a per-connection setting. Optionally make `DEFAULT_TTS_CHUNK_CHAR_LIMIT` configurable so users can trade smaller chunks for staying under the timeout. - Affected setups: self-hosted OpenAI-compatible TTS (e.g. LocalAI, custom bridges) using cloning/expressive models where RTF > ~0.7. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:24:20 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@cha1latte commented on GitHub (Jun 2, 2026):

fixed in refactor in #1990

<!-- gh-comment-id:4607642109 --> @cha1latte commented on GitHub (Jun 2, 2026): fixed in refactor in #1990
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#972
No description provided.