From 83dc910624ba9c03efc1b5401c97293f7836e0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=27=C3=A9lectron=20rare?= <108685187+electron-rare@users.noreply.github.com> Date: Fri, 26 Jun 2026 19:43:57 +0200 Subject: [PATCH] fix(sound): recover port 57121 from zombie on boot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The data-only boot opened the OSC receive port 57121 but fell back silently to the lang port when it was busy — so /pose (data_only_viz) and /data (data_feeds bridge), both sent to 57121, never reached sclang and the patch looked alive but reacted to nothing. The port is typically squatted by a zombie: a scsynth or data_feeds bridge launched by a previous boot via unixCmd inherits the 57121 socket FD and outlives its sclang parent, so a fresh boot can't bind it. Instead of falling back, free the stale holder (lsof -ti UDP:57121 | xargs kill -9) and retry openUDPPort. Verified: a planted zombie on 57121 is killed and the port recovered on boot ("57121 recupere — sclang listening on 57121"). --- sound_algo/data_only/boot.scd | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sound_algo/data_only/boot.scd b/sound_algo/data_only/boot.scd index 32a1144..cc60a11 100644 --- a/sound_algo/data_only/boot.scd +++ b/sound_algo/data_only/boot.scd @@ -92,13 +92,24 @@ Routine({ var maxWait, waited; - // Ouvre le port 57121 pour recevoir les /control/* du launcher et - // de tout client externe (cf OSCSender swift). Echec silencieux - // si le port est deja pris (ex: web bridge actif) — dans ce cas - // sclang reste sur son langPort par defaut. + // Ouvre le port 57121 pour recevoir /control/* (launcher), /pose/* et + // /data/* (data_only_viz + data_feeds bridge). Si le port est pris, + // c'est presque toujours un holder zombie : un scsynth/bridge orphelin + // d'un sclang precedent qui a herite le socket 57121 via unixCmd et a + // survecu a son parent. On le libere et on reessaie, plutot que de + // fallback silencieusement (les /pose/data n'arriveraient jamais sur le + // langPort de repli). if(thisProcess.openUDPPort(57121).not) { - ("[data-only/boot] WARN: port 57121 occupe, fallback sur langPort = " - ++ NetAddr.langPort).postln; + "[data-only/boot] 57121 occupe — liberation du holder zombie...".postln; + "lsof -ti UDP:57121 | xargs kill -9 2>/dev/null".unixCmd; + 0.5.wait; + if(thisProcess.openUDPPort(57121).not) { + ("[data-only/boot] WARN: 57121 toujours occupe, fallback sur langPort = " + ++ NetAddr.langPort).postln; + } { + ("[data-only/boot] 57121 recupere — sclang listening on " + ++ NetAddr.langPort ++ " + 57121").postln; + }; } { ("[data-only/boot] sclang listening on " ++ NetAddr.langPort ++ " + 57121").postln; };