Skip to content

Commit 36dfbce

Browse files
TuxLux40claude
andcommitted
fix(daemon): start metrics loop + bypass TRCC_DAEMON fork bomb
run_daemon() now calls trcc.start_metrics_loop() so the 50ms tick drives LCD/LED frames — without it the device shows a frozen/blank screen in daemon mode. _build_trcc() passes an explicit PlatformFactory.current() to _boot_trcc() so the daemon-proxy short-circuit is skipped. With TRCC_DAEMON=1 inherited and no explicit platform, _boot.trcc() called ensure_daemon() before the socket was bound, spawning another daemon process — infinite fork chain (upstream issue #162). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 73ff4e4 commit 36dfbce

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/trcc/daemon.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ def run_daemon(*, verbosity: int = 0) -> int:
6767
qapp = _build_qapp()
6868
trcc = _build_trcc()
6969

70+
# Start the 50ms tick + sensor-poll loop. Without this nothing drives
71+
# the LED segment display / LCD frames in daemon mode and the device
72+
# shows a frozen / blank screen. Safe because _build_trcc() builds with
73+
# an explicit platform, so system_svc is injected.
74+
trcc.start_metrics_loop()
75+
7076
# Renderer flows through so ``Topic.FRAME`` surface payloads get
7177
# encoded into a JSON-safe envelope before reaching TrccProxy clients.
7278
server = IPCServer(trcc=trcc, renderer=trcc.renderer)
@@ -179,7 +185,12 @@ def _build_trcc() -> Any:
179185
set, and theme/data callables injected.
180186
"""
181187
from ._boot import trcc as _boot_trcc
182-
return _boot_trcc(discover_now=True)
188+
from .adapters.system import PlatformFactory
189+
# Pass an explicit platform so _boot.trcc() skips the daemon-proxy
190+
# short circuit. With platform=None and TRCC_DAEMON=1 inherited, that
191+
# branch calls ensure_daemon() before our own socket is bound, which
192+
# spawns another `trcc daemon` → fork bomb (upstream issue #162).
193+
return _boot_trcc(PlatformFactory.current(), discover_now=True)
183194

184195

185196
# Module-level holder so the Qt heartbeat timer survives past the function

0 commit comments

Comments
 (0)