Repository navigation
Conversation
… exits and a missing server - Several runners exiting on one session aborted Wolf: delete_virtual_sink() called promise::get_future() each time, and the second call threw future_already_retrieved. The index is now read through a shared_future, and only the first delete unloads the module. - libpulse's plain pa_mainloop isn't thread-safe, yet queue_op ran pa_context_* calls on API and runner threads while the mainloop iterated on its own, so bursts of runner starts and exits corrupted memory (SIGSEGV, queue.c asserts). It now uses pa_threaded_mainloop and runs every op under its lock; ops queued while connecting run once READY. delete_virtual_sink no longer blocks under the lock: if the module is still loading, the load callback unloads it, and holds its own VSink reference (released if libpulse cancels the request). The sink spec is formatted before queueing, since sink_name is a view of the caller's string. - With no reachable PulseAudio and no fallback container, run() read ->server from an empty optional and segfaulted; runners also got an empty pulse mount and PULSE_SERVER that Docker rejects. Wolf now starts without audio instead.
Every runner started on a session (its app, plus any started through the API's runners/start) was handed the session's virtual sink and deleted it on exit. So the first runner to exit removed the sink while the others still ran: later runners got a PULSE_SINK that no longer existed and the session's pulsesrc failed with "Internal data stream error". The sink now belongs to the session: the StopStreamEvent handler deletes it when the session is removed, and session runners get no audio_sink. A lobby keeps deleting its sink when its single runner exits. /resume replaces the StreamSession instance, so it now carries the audio sink over like the Wayland display and devices; otherwise the resumed session would never remove it.
This branch has not been deployed
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.
Summary: A session's audio sink is now removed when the session stops, not when its first app exits. Apps started on a running session through the API no longer lose their audio when another one exits.
Builds on #578. Only the last commit is new here; I'll rebase once #578 lands.
Why
Every runner started on a session (its app, plus any started through
/api/v1/runners/start) was given the session's virtual sink and deleted it when it exited. So the first runner to exit removed the sink while the others were still running. Runners started after that get aPULSE_SINKthat no longer exists, and the session'spulsesrcfails with "Internal data stream error". I mentioned this as a follow-up in #578.What changed
StopStreamEventhandler deletes the stopping session's sink, and session runners get noaudio_sink. A lobby still deletes its sink when its single runner exits./resumereplaces theStreamSessioninstance, so it now carries the sink over, the same way it carries over the display and devices. Without that, the resumed session would never remove its sink./resumekeeps the same sink. They run without a PulseAudio daemon by checking the sink'sdeletedflag.Risk
Low. Sinks are created exactly as before; only the moment they're removed changes. Every session path I tested ends with no sinks or modules left in PulseAudio.
Testing
QA result: pass. I ran the real Wolf binary with a real PulseAudio:
runners/start "sleep 60"and thenrunners/start true,betadrops the sink whilesleepis still running. With this change the sink stays, andsessions/stopremoves it.Not tested: a lobby runner exiting (QA had no
waylanddisplaysrc), Docker runners, and a real Moonlight client's audio stream.Test evidence
audio_sinkfails "A runner exiting leaves its session's virtual audio sink alone". Dropping the/resumecarry-over fails the resume test and leaks a sink on every resume against real Wolf.wolftests ~[DOCKER]: the only failures are the same environment-dependent ones as on the base.clang-format18.1.8 is clean.Follow-ups
None.