fix: skip JACK client deactivate() if server is already dead
jack.Client.deactivate() is a synchronous protocol call that hangs indefinitely on a broken server socket. In the audio profile change handler, stop_jack() kills the jackd process first, then tries jack_client.stop() which calls deactivate() on the now-dead socket. Fix: check if jackd is still running via pidof before calling deactivate(). If the server is already gone, skip directly to close() which just closes the local file descriptor (safe and fast). This was causing the POST /api/audio/profile endpoint to hang for 30+ seconds on every buffer change.
This commit is contained in:
+5
-1
@@ -913,8 +913,12 @@ class JackAudioClient:
|
||||
"""Deactivate and close the JACK client."""
|
||||
if not self._active or self._client is None:
|
||||
return
|
||||
# Skip deactivate() if JACK server is already dead — it hangs
|
||||
# on a broken server socket (Broken pipe).
|
||||
try:
|
||||
self._client.deactivate()
|
||||
import subprocess
|
||||
if subprocess.run(["pidof", "jackd"], capture_output=True).returncode == 0:
|
||||
self._client.deactivate()
|
||||
except Exception as exc:
|
||||
logger.warning("JACK deactivate error: %s", exc)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user