Repository navigation
Description
Surfaced while diagnosing a CI failure in Chat UI, API, Update and GGUF inference. The test defect that made it fail the job is fixed separately in #9711; this issue is the underlying backend behaviour, which is real, is on main, and is NOT fixed.
What happens
The Studio backend stops serving every route for a while, then recovers on its own. Observed three times in one job:
- 10.03s
- 33.2s
- 27.75s (on a different backend instance)
During a window, /api/liveness and /api/health both time out against a 10s client budget. Each window ends on an /api/inference/status whose process_time_ms equals the length of the window, so the request was accepted and then sat there. The process never dies, and the end-of-run liveness check passes.
How often
Over 11 days of that workflow the affected step ran 1711 times and failed once, and on main it is 0 failures in 287 runs. Passing runs report 24 samples, 0 non-200 with a median worst latency of 47.7ms, roughly 200x under the budget. So this is rare, but a 33s total stall is far outside the normal spread rather than the tail of it.
Why it matters even though CI now tolerates it
The launcher watchdog (studio/src-tauri/src/commands.rs) polls every 15s and gives up after 3 consecutive failures, widened to 12 when a probe times out against a generating backend, plus a 30s last-chance probe. A 33s stall is two strikes, so the launcher keeps the backend. That is the right behaviour and is why #9711 relaxes the test to the same rule. But a user on a 33s stall sees an application that is completely unresponsive to every request, with no indication anything is wrong.
Two hypotheses, both refuted
- A blocking call on the event loop. Refuted: the status probe already runs off the loop through
_STATUS_PROBE_EXECUTOR. - The MLX self-heal thread holding the GIL. Refuted by the logs: the only instance in that job which ran the self-heal had ZERO stalls (max 3363ms over 376 requests), and neither stalled instance ran it at all.
Suggested next step
The mechanism is still unknown and I have not been able to reproduce it without a macOS host, so I have deliberately not guessed at a patch. The most direct way to name it is a py-spy dump taken against a backend while it is stalled, which identifies the GIL holder rather than inferring it. A watchdog thread that dumps on N consecutive slow self-probes would catch it without needing anyone present.
Activity
hellopahe commentedon Aug 25, 2026
The pr is basically the watchdog you sketched, except the dump happens on faulthandler's timer thread. That one's C and doesn't need the GIL, so it still fires if the stall turns out to be a GIL holder.
studio: dump the backend's own thread stacks while a stall is in prog…
danielhanchen commentedon Oct 19, 2026
Fixed! Sorry on the delay. The stall watchdog from #9715 showed that the backend's event loop froze while it built its OpenAPI schema the first time the chat sidebar asked for it, so every request, liveness included, waited a few seconds. On a starved runner that is long enough to look like this. #14239 now builds the schema in a worker thread, so the backend keeps answering while it runs.
To update: Unsloth Desktop will have an update banner. For Studio, use
unsloth studio update. For Docker, usedocker exec <container> unsloth-studio-update. Reopen if it still happens.Studio: build the OpenAPI schema off the event loop (unslothai#14239)