fix: verify JACK is operational before returning from start_jack()
CI / test (push) Has been cancelled

start_jack() only checked _jack_is_running() (pgrep -x jackd) which
returns True even when jackd exists but failed to initialize the ALSA
device — the process starts but hangs without creating SHM segments,
making jack_lsp/jack_wait fail. The profile handler then continues as
if JACK is running, jack_client.start() fails with server_error, the
pi-multifx ports never get created, and NAM CPU drops to 0%.

Fix: also verify /dev/shm/jack_default_0_0 (the JACK control socket)
exists before declaring JACK started. This socket is only created after
the ALSA device is successfully initialized, so a zombie jackd with a
bad period/rate combination won't pass the check.
This commit is contained in:
2026-06-18 17:17:33 -04:00
parent ce82207d03
commit c0c2538c80
+11 -1
View File
@@ -323,11 +323,19 @@ class AudioSystem:
logger.error("jackd not found — install jackd2") logger.error("jackd not found — install jackd2")
return False return False
# Wait for readiness via jack_wait # Wait for readiness — verify JACK is actually operational
# (process exists AND SHM socket is created), not just that
# the jackd process spawned. jackd can start but fail to
# initialize the audio device, leaving a zombie process that
# pgrep finds but jack_lsp can't connect to.
deadline = time.monotonic() + timeout deadline = time.monotonic() + timeout
while time.monotonic() < deadline: while time.monotonic() < deadline:
time.sleep(0.3) time.sleep(0.3)
if _jack_is_running(): if _jack_is_running():
# Double-check JACK is actually operational by testing
# the SHM socket — jack_default_0_0 is created only
# after the ALSA device is successfully initialized.
if Path("/dev/shm/jack_default_0_0").is_socket():
logger.info( logger.info(
"JACK started: period=%d, nperiods=%d, rate=%d", "JACK started: period=%d, nperiods=%d, rate=%d",
profile["period"], profile["nperiods"], profile["rate"], profile["period"], profile["nperiods"], profile["rate"],
@@ -336,6 +344,8 @@ class AudioSystem:
if self.config.auto_connect: if self.config.auto_connect:
self.connect_fx_ports() self.connect_fx_ports()
return True return True
# JACK process exists but SHM not ready yet — keep waiting
continue
# Timed out — check for common issues # Timed out — check for common issues
poll = proc.poll() poll = proc.poll()