fix(viewer): clear stale PulseAudio pid file so audio survives reboot#3113
Merged
Conversation
- rm the pid file before the --daemonize start in start_pulseaudio()
- XDG_RUNTIME_DIR is a persistent container path (not a per-boot
tmpfs), so a SIGKILLed daemon's pid file survives a restart/reboot
and trips a self-exec race ("Daemon already running"), leaving
Qt 6 video silent (issue #3112)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
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.



Issues Fixed
Fixes #3112 (follow-up to #3001).
Description
On Qt 6 boards (Pi 4/5, x86), HDMI audio works on a fresh install but dies after a reboot — intermittently. The viewer logs the generic
E: [pulseaudio] main.c: Daemon startup failed.and falls into the "video will play without audio" branch; with no PulseAudio server, QtMultimedia has no audio backend and video plays silent.Root cause (captured on real hardware via
--log-target=file:): the hidden reason isE: [pulseaudio] pid.c: Daemon already running.— a stale${XDG_RUNTIME_DIR}/pulse/pid. In Docker,/runis not a per-boot tmpfs like on bare metal — it lives in the container's writable layer — so the pid file survives a container restart or a device reboot (therestart: alwaysviewer is restarted, reusing the layer).--daemonize=yesself-re-execs the daemon; the pre-exec process overwrites the stale pid file with its own PID, then the re-exec'd process re-runspa_pid_file_create()and racily reads that PID as a livepulseaudio(itself) and aborts. The race is why the failure is intermittent.Fix: remove the stale pid file before starting the daemon. The stale socket is already handled by
module-native-protocol-unix's own stale-socket unlink, so only the pid file needs clearing.Validation (A/B via a
docker restartloop that reproduces the exact stale-/runcondition):Checklist
🤖 Generated with Claude Code