Skip to content

spice-gtk: fix SPICE deadlock under memory pressure - #7853

Open
evan314159 wants to merge 1 commit into
utmapp:mainfrom
evan314159:fix-spice-gtk-coreaudio-hang
Open

spice-gtk: fix SPICE deadlock under memory pressure#7853
evan314159 wants to merge 1 commit into
utmapp:mainfrom
evan314159:fix-spice-gtk-coreaudio-hang

Conversation

@evan314159

Copy link
Copy Markdown

CoreAudio AudioOutputUnitStop() hangs under high memory load (e.g. concurrent LLM usage). GStreamer calls AudioOutputUnitStop() in the main context thread, causing all SPICE services including video and input to hang while the VM is still running.

Short-term fix (this PR): run GStreamer state changes on a separate, serialised worker thread per stream so the hang does not block other SPICE services.

Long-term fix?: this appears to require either a fix from Apple or for audio to run in a separate process. Once the connection to CoreAudio is hung, it does not seem to be recoverable by the same process. FB24659938 opened with Apple.

To reproduce:

  • Start a Linux VM using QEMU, with a graphical desktop and optionally a serial console, and play a video.
  • Start a local LLM app like LM Studio and load a large model taking almost all memory (e.g. 17GB of a 24GB system) causing memory pressure but not complete failure.
  • VM video, audio and input will hang. The serial console will remain available and there will be no console or dmesg errors.

Developed with AI but human tested. Before the change, all video, audio, and input hung within a few minutes of running a local LLM, and live process sampling (sample(1)) found that the main context was hung in AudioOutputUnitStop(). Post-change, audio still hangs but video and input are unaffected, and only the worker is blocked. Test system: macOS 27.0 latest developer beta (26A5425a), UTM 5.0.5 beta.

Assisted-by: Claude:claude-opus-4-8

AudioOutputUnitStop() called from GStreamer in the main context thread
hangs under high memory load (e.g. concurrent LLM usage), causing all SPICE
services including video and input to hang while the VM is still running.

Short-term fix (this PR): run GStreamer state changes on a separate,
serialized worker thread per stream so the hang does not block other SPICE
services.

Long-term fix?: this appears to require either a fix from Apple or for
audio to run in a separate process. Once the connection to CoreAudio is
hung, it does not seem to be recoverable by the same process.

Assisted-by: Claude:claude-opus-4-8
@evan314159

Copy link
Copy Markdown
Author

Also confirming I read https://github.com/utmapp/UTM/blob/main/CONTRIBUTING.md and as far as I can tell followed it. I used /utm-review but not /utm-submit.

@osy osy added this to the v5.0 milestone Sep 5, 2026
@evan314159

Copy link
Copy Markdown
Author

The failed check looks like a build timeout and not an issue with the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants