Repository navigation
fix(worker): stop leaking infernet daemons (326 procs / 22 GB on dev2) - #43
Merged
Merged
Conversation
The 5-minute plugin refresh ran `infernet update` unconditionally. That command has no version check: it reinstalls and runs `infernet setup`, which restarts the daemon over IPC. A restart sometimes leaves the old daemon alive (it drops its socket and pidfile, then hangs on its offline heartbeat), so every few ticks another one piled up. - refresh_plugins: run `infernet update` only when npm's latest @infernetprotocol/cli differs from the installed version; unknown on either side (offline) means skip. - reap_stale_infernet_daemons (Linux): at worker start and every tick, SIGTERM (then SIGKILL after 5 s) any `infernet ... start --foreground` owned by this uid that is not the pid in daemon.pid; does nothing without a live daemon of record. - Tests: cmdline matching, and a real-process test that only the unrecorded daemon dies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThreatCrush Security Scan8 finding(s) MEDIUM: 8
Snippets are redacted; ThreatCrush never prints matched credential material. |
This was referenced Oct 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dev2's
c0mpute-worker.servicehad 326infernet start --foregrounddaemons (~22 GB), which pushed the box under earlyoom's threshold and got unrelated processes killed.Cause: the 5-minute plugin refresh ran
infernet updateevery tick.infernet updatehas no version check — it re-runs the installer andinfernet setup, which restarts the daemon over IPC. The old daemon sometimes releases its socket/pidfile but never exits (its offline heartbeat has no timeout), so another daemon accumulated every few ticks.Fix
infernet updatewhen npm's latest@infernetprotocol/clidiffers from the installed version (unknown = skip, so offline nodes stop churning).reap_stale_infernet_daemons()at worker start and on every tick: stops anyinfernet … start --foregroundof the same uid that isn't the pid indaemon.pid(SIGTERM, SIGKILL after 5 s); never acts without a live daemon of record.cargo test -p c0mpute-cligreen.A matching shutdown-deadline fix goes to infernet itself.
🤖 Generated with Claude Code