Conversation
…ng killed
spawnSync kills the child process when the timeout expires. The TLDR daemon
takes 30-60s to index a large project, so on timeout spawnSync sends SIGTERM,
killing the daemon. The next Claude session start finds no running daemon and
spawns another — repeat across sessions = dozens of orphaned 3GB processes.
Replace spawnSync with spawn({ detached: true }) + child.unref() so the daemon
runs as a true independent background process and survives after the hook exits.
The existing PID guard (isDaemonProcessRunning) already prevents duplicate
spawns when the PID file exists and the process is alive. This fix ensures the
daemon isn't killed immediately after being spawned, so the PID file stays valid.
- getPidPath now reads from .tldr/daemon.pid (matching the Python daemon)
instead of /tmp/tldr-{hash}.pid which was never written by the daemon
- isDaemonProcessRunning now handles EPERM (process alive, different
permissions) and cleans up stale PID files on ESRCH
- Rebuilt all dist bundles that import daemon-client
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Ported from parcadei/Continuous-Claude-v3#153 by @marcuspuchalla
Problem
tryStartDaemonusesspawnSyncwith a 5s timeout that kills the child. The TLDR daemon takes 30-60s to index a large project, so it gets killed before finishing. With multiple sessions, this compounds into dozens of orphaned 3GB processes.Fix
Replace
spawnSyncwithspawn({ detached: true })+child.unref()so the daemon runs as a true independent background process.Impact