fix: clean stale JACK SHM segments on stop_jack() and at boot

When JACK is killed forcefully (killall -9), the /dev/shm/jack_sem.*
shared memory segments and /dev/shm/jack_db-0/ directory are left
behind. The next start_jack() call finds these stale segments and
fails silently — no audio output, JACK process may appear briefly
then crash.

Fix:
- AudioSystem.stop_jack(): after killing jackd, also rm -rf
  /dev/shm/jack* to clean up stale SHM.
- main.py boot sequence: clean SHM before first start_jack(), so
  the pedal recovers from crashes that happened before this fix.
This commit is contained in:
2026-06-17 17:39:01 -04:00
parent ebdf98076a
commit 1619b2e90e
2 changed files with 25 additions and 0 deletions
+13
View File
@@ -130,6 +130,19 @@ class PedalApp:
)
self.audio_system = AudioSystem(self.audio_config)
self.audio_system.setup_i2s(reboot_hint=True)
# Clean stale JACK SHM segments from prior crashes before starting
try:
import shutil
from pathlib import Path
for p in Path("/dev/shm").glob("jack*"):
if p.is_dir():
shutil.rmtree(p, ignore_errors=True)
else:
p.unlink(missing_ok=True)
except Exception:
pass
if self.audio_config.jack_enabled:
self.audio_system.start_jack(timeout=10)
else: