10000 timeout: on receiving TERM signal, child process is not terminated · Issue #8040 · uutils/coreutils · GitHub
[go: up one dir, main page]

Skip to content
timeout: on receiving TERM signal, child process is not terminated #8040
Open
@martinkunkel2

Description

@martinkunkel2

(test system: WSL2, Ubuntu 24.04 - also reproducible in github codespaces)

gnu coreutils behavior is that child process is terminated when receiving TERM signal:

$ timeout 42 sleep 42 &
[1] 16343
$ ps -ef |grep sleep
martin     16343    3426  0 17:04 pts/5    00:00:00 timeout 42 sleep 42
martin     16345   16343  0 17:04 pts/5    00:00:00 sleep 42
$ kill 16343
[1]+  Terminated              timeout 42 sleep 42
$ ps -ef |grep sleep

with timeout from uutils

$ target/debug/coreutils timeout 42 sleep 42 &
[1] 16507
$ ps -ef |grep sleep
martin     16507    3426  0 17:04 pts/5    00:00:00 target/debug/coreutils timeout 42 sleep 42
martin     16509   16507  0 17:04 pts/5    00:00:00 sleep 42
$ kill 16507
[1]+  Terminated              target/debug/coreutils timeout 42 sleep 42
$ ps -ef |grep sleep
martin     16509    2710  0 17:04 pts/5    00:00:00 sleep 42

the child process sleep 42 is still running and parent PID is now 2710:

$ ps -ef |grep 2710
root        2710    2709  0 16:52 ?        00:00:00 /init

I saw this behavior when debugging sporadic failures in gnu compatibility tests.
The test tests/tail/inotify-rotate.sh needs the termination of child process for cleanup.
Otherwise a lot of tail processes remain alive after the tests are finished:

martin     44860    2710  2 17:12 pts/5    00:00:00 tail -s.1 --max-unchanged-stats=1 -F k
martin     44876    2710  3 17:12 pts/5    00:00:00 tail -s.1 --max-unchanged-stats=1 -F k
martin     44891    2710  3 17:12 pts/5    00:00:00 tail -s.1 --max-unchanged-stats=1 -F k
...

and with the next test runs I observe messages like tail: inotify cannot be used, reverting to polling: Too many open files.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0