spice-gtk: fix SPICE deadlock under memory pressure - #7853
Open
evan314159 wants to merge 1 commit into
Open
Conversation
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
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. |
Author
|
The failed check looks like a build timeout and not an issue with the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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