Skip to content

fix(debug): strace the container's whole process tree by default - #9

Merged
chxmxii merged 1 commit into
mainfrom
fix/strace-process-tree
Aug 23, 2026
Merged

chxmxii merged 1 commit into
mainfrom
fix/strace-process-tree

Conversation

@chxmxii

@chxmxii chxmxii commented Aug 23, 2026

Copy link
Copy Markdown
Owner

containershell strace attached only to the container's init PID, which is typically idle (blocked in rt_sigsuspend/wait4) — so the output was one interrupted-syscall line and then silence, while all real activity happened in untraced child processes (-f only follows forks created after attach).

Fix: by default, enumerate the container's existing process tree from host /proc (reusing the walker from the top fallback) and attach strace to every process, with -f following anything forked later. --pid still traces a single PID; --follow-forks applies there.

Verified live (rootless Podman, alpine with idle sleep init + active background child): attaches to all 3 processes and streams child syscalls (nanosleep, wait4, SIGCHLD, fork/exit cycles). go vet + go test -race green, new unit test for ProcTreePids.

🤖 Generated with Claude Code

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>
@chxmxii
chxmxii merged commit 34585eb into main Aug 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant