krallin / tini

A tiny but valid `init` for containers
MIT License
9.66k stars 505 forks source link

Unable to strace tini's children processes #181

Open filipdavidovic opened 3 years ago

filipdavidovic commented 3 years ago

Hi,

I am trying to profile containers using strace. The command I use is: strace -ff -o /log/trace.log tini -- /entrypoint-wrapper.sh /original-entrypoint.sh (note -ff which follows fork calls). As you can imagine, /entrypoint-wrapper.sh calls /original-entrypoint.sh using an exec call. Both of the scripts are Bash.

Looking at the output of the command, I can see strace attaching only to the tini process, but to none of its children. Moreover, the /log directory contains only a single log file for the tini process. The file has a bunch of wait4 and rt_sigtimedwait, which I imagine to be signal handling calls used by tini.

Running the above command without tini works as expected. How can I strace tini's children?

Thank you!

tspearconquest commented 1 year ago

I wonder if the -g flag would help here?

strace -ff -o /log/trace.log tini -g -- /entrypoint-wrapper.sh /original-entrypoint.sh