Repository navigation
fix(debug): strace the container's whole process tree by default - #9
Merged
Merged
Conversation
Attaching only to the container's init PID showed a single line (e.g. "rt_sigsuspend([], 8") and then nothing: init is usually idle, blocked waiting for signals or children, while the real activity happens in child processes that were never traced (-f only follows forks created after attaching). By default strace now enumerates the container's existing process tree from the host /proc (ProcTreePids, shared with the top fallback) and attaches to every process, plus -f for anything forked later. --pid still targets a single process, with --follow-forks opting into -f there. Co-Authored-By: Claude Fable 5 <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.
containershell straceattached only to the container's init PID, which is typically idle (blocked inrt_sigsuspend/wait4) — so the output was one interrupted-syscall line and then silence, while all real activity happened in untraced child processes (-fonly follows forks created after attach).Fix: by default, enumerate the container's existing process tree from host
/proc(reusing the walker from thetopfallback) and attach strace to every process, with-ffollowing anything forked later.--pidstill traces a single PID;--follow-forksapplies there.Verified live (rootless Podman, alpine with idle
sleepinit + active background child): attaches to all 3 processes and streams child syscalls (nanosleep,wait4,SIGCHLD, fork/exit cycles).go vet+go test -racegreen, new unit test forProcTreePids.🤖 Generated with Claude Code