Transcription on Apple Silicon hard-crashes the backend (SIGABRT in mlx::core::metal::get_command_encoder)
Summary
On Apple Silicon, transcribing an audio file via the MLX/Whisper STT path hard-crashes the entire Python backend process with SIGABRT ("Abort trap: 6"). This is a native C++ abort inside MLX's Metal layer, not a catchable Python exception — so the process dies rather than returning an HTTP 500, and the server becomes unresponsive (the uvicorn --reload parent keeps the port held while the worker is dead).
This is distinct from #699: that issue is a catchable Stream(gpu, 1) not in current thread error on the TTS path that marks a generation row failed. This one is an uncatchable native abort on the STT/transcribe path that takes down the whole process. Same MLX-on-Apple-Silicon family, same package versions, different (harder) failure mode.
Environment
- Repo at
cabef1b(v0.5.0), built from source viajust setup+just dev-backend - macOS 26.5.1, Darwin 25.5.0, arm64 (Apple Silicon)
- Python 3.12.13 (Homebrew)
mlx==0.31.2,mlx-audio==0.4.1,mlx-lm==0.31.1,transformers==4.57.3/health:backend_type: mlx,backend_variant: cpu,gpu_type: MPS (Apple Silicon)- (
mlx-audio/mlx-lminstalled manually — see the companion setup-python issue)
Reproduction
just dev-backend # backend_type: mlx
curl -X POST http://127.0.0.1:17493/transcribe -F "[email protected]" -F "model=turbo"
The Python process aborts during inference. A crash report appears in ~/Library/Logs/DiagnosticReports/Python-*.ips.
Crash details
EXC_CRASH (SIGABRT), abort() called. The triggered ("triggered":true) thread is an MLX scheduler stream thread, and the stack unwinds through Metal command-encoder creation into a C++ throw → std::terminate → abort:
mlx::core::scheduler::StreamThread::thread_fn()
mlx::core::eval(std::vector<mlx::core::array>)
mlx::core::eval_impl(...)
mlx::core::gpu::eval(mlx::core::array&)
mlx::core::metal::get_command_encoder(mlx::core::Stream) <-- throws
__cxa_throw -> std::terminate -> abort (libsystem_c.dylib: "abort() called")
Because the exception is thrown on MLX's own stream thread and is never caught, it propagates to std::terminate() and aborts the process — no Python traceback, no HTTP error response.
Impact
- Any transcription on the default Apple-Silicon (MLX) backend kills the server.
- There is no built-in way to fall back to PyTorch —
get_backend_type()inbackend/utils/platform_detect.pyalways returns"mlx"on Apple Silicon when MLX imports successfully, with no override. (#699 notes the same "cannot switch away from MLX" limitation.)
Suggested follow-ups
-
Make the inference path crash-safe / recoverable. A native abort on a background MLX stream thread can't be caught from Python, so the fix likely has to be on the MLX-usage side (stream/thread handling — possibly the same root cause as #699's thread-local stream issue) rather than a
try/except. -
Add a backend override so users can fall back to PyTorch/CPU when the MLX Metal path is broken. A small
VOICEBOX_BACKENDenv var inget_backend_type()works well:forced = os.environ.get("VOICEBOX_BACKEND", "").strip().lower() if forced in ("mlx", "pytorch"): return forcedThis doubles as the missing workaround for #699.
-
Surface inference failures to the server log instead of letting them vanish (also raised in #699).
Workaround (verified)
With the env override above applied, forcing the PyTorch backend transcribes reliably on the same machine (exact-match output on both .wav and .mp3, no crash):
VOICEBOX_BACKEND=pytorch backend/venv/bin/uvicorn backend.main:app --port 17493
# /health then reports backend_type: pytorch
Related: #699 (MLX TTS thread-local stream error on Apple Silicon).
Hit the same MLX/Metal native-abort family on the TTS generation path, not just STT transcribe:
- voicebox v0.5.0 (dmg install), macOS arm64 (Apple Silicon), backend_type: mlx
- Repro: Capture → refine (Whisper base + Qwen3 4B LLM, both load fine) → generate (Qwen3-TTS 1.7B via MLX)
- Crash during
ICL Generation, backend process dies with:
libc++abi: terminating due to uncaught exception of type std::runtime_error:
[METAL] Command buffer execution failed: Caused GPU Timeout Error (00000002:kIOGPUCommandBufferCallbackErrorTimeout)
Same as this issue: uncatchable native abort on an MLX stream thread kills the whole process, and the frontend only ever sees the resulting [Errno 32] Broken pipe once the dead process can't be written to. Any subsequent request (including delete) fails the same way until the process is restarted.
+1 for the proposed VOICEBOX_BACKEND override — would let us fall back to PyTorch for TTS generation too, not just transcription.
Hit what looks like the same crash family on a fresh install today, but with a different signal/function — flagging here rather than opening a duplicate in case it's a sibling bug in the same MLX-on-Apple-Silicon inference path.
Environment: Voicebox v0.5.0 (DMG release, not source build) · macOS 26.5.2, Darwin 25.5.0, arm64 (Mac15,3) · first run, models had just finished downloading
Reproduction: Held the dictation hotkey, spoke, released. Pill went Recording → Transcribing → "Load failed". Backend had segfaulted (~/Library/Logs/DiagnosticReports/voicebox-server-*.ips). Reproduced twice in a row, same signature both times.
Crash: EXC_BAD_ACCESS (SIGSEGV), near-null deref at 0x8, in mlx::core::eval_impl → array::eval() → numpy array conversion, on a background pythread — differs from the OP's SIGABRT in metal::get_command_encoder, possibly same root cause surfacing differently. Full backtrace and details in the attached file.