#453·VibeVoice

ASR gradio demo: Stop button is a shared global, so one user's Stop halts every concurrent user's transcription

Author: ammar-iitmCreated Sep 18, 2026Updated Sep 18, 2026

Summary

demo/vibevoice_asr_gradio_demo.py uses a single process-wide global boolean to implement the Stop button, but the app is explicitly configured to serve multiple concurrent requests. The result: clicking Stop on your own transcription also stops everyone else's in-flight transcription on the same server, and there's no way to stop only your own.

Where

  • stop_generation_flag = False — a bare module-level global (demo/vibevoice_asr_gradio_demo.py:436)
  • StopOnFlag(StoppingCriteria) — the generation stopping criteria that reads this same global on every decode step, for every request (:439)
  • reset_stop_flag() — sets the global False at the start of any transcription request, and set_stop_flag() sets it True when any user clicks Stop (:1131 / :1136)
  • demo.queue(default_concurrency_limit=3) — the app explicitly enables up to 3 concurrent requests; the comment above it even says "Enable queue for concurrent request handling" (:1263)

The bug

Because stop_generation_flag is a single Python-process-wide variable (not per-session, per-request, or per-thread state), and StopOnFlag is shared across every concurrently-running generate() call:

  1. User A clicks Stop while Users B and C are also transcribing. set_stop_flag() sets the one global stop_generation_flag = True. Every in-flight StopOnFlag.__call__ — including B's and C's — reads the same global and returns True, halting all three generations, not just A's.
  2. Conversely, if User B starts a new transcription while User A's stop request is still being processed, B's click first runs reset_stop_flag() (global back to False), which can silently un-stop A's request before it actually halts — A's Stop click appears to do nothing.

This is a straightforward consequence of using a bare global for what needs to be per-request state, combined with default_concurrency_limit=3 making concurrent requests from different users the expected, documented mode of operation (not an edge case).

Suggested fix direction

Replace the single global with per-request state — e.g. a threading.Event (or a small dict keyed by a per-request id) created fresh inside transcribe_audio() and threaded through to a StopOnFlag instance constructed for that call, instead of a module-level flag read by every concurrent generation.

Verification

I found and traced this by reading the code (this environment has no GPU/model weights to actually launch the Gradio app and reproduce it live with two real concurrent sessions), so I'm not claiming to have observed it happen — but the mechanism is unambiguous from the source: one global, read by every concurrent StoppingCriteria instance, written by every user's Stop click and every new request's reset. Happy to help with a fix if useful.

Generated with Claude Code