fix: add 1.5s stabilization check in start_jack to catch flaky JACK startup
CI / test (push) Has been cancelled

JACK can briefly become operational (jack_lsp returns ports) during
startup then crash when the ALSA device fails. The initial readiness
check catches this window and returns True prematurely. Add a 0.5s
stabilization window after first success — if JACK drops, continue
the wait loop instead of returning.

Without this, profile changes succeed in the API but leave JACK in a
zombie state: process exists with SHM infrastructure but can't serve
clients.
This commit is contained in:
2026-06-18 18:08:24 -04:00
parent 32990f9744
commit f1c6f64dc8
+12 -4
View File
@@ -353,10 +353,18 @@ class AudioSystem:
"JACK started: period=%d, nperiods=%d, rate=%d",
profile["period"], profile["nperiods"], profile["rate"],
)
# Auto-connect ports if enabled
if self.config.auto_connect:
self.connect_fx_ports()
return True
# Stabilization check — JACK can start briefly then crash
# if the ALSA device is flaky. Wait 1.5s with retries.
time.sleep(0.5)
if _jack_is_operational():
# Auto-connect ports if enabled
if self.config.auto_connect:
self.connect_fx_ports()
return True
# JACK was running but dropped — don't return yet,
# continue the wait loop for a fresh attempt
logger.warning("JACK appeared briefly then became non-operational")
continue
# JACK process exists but not ready yet — keep waiting
continue