Puppet Version:{} Seen in 7.14.0, 7.23.0, and current git 61234be0e4d6. The code originates in d4c1582ed0c2a3e. Puppet Server Version: N/A; reproducible via puppet apply. ** OS Name/Version:{} Seen in AlmaLinux 8.7 and Debian Unstable. This is probably POSIX-specific; the affected code runs under if Puppet.features.posix? Describe your issue in as much detail as possible… When puppet applies an exec resource, and the command run by that exec returns an EOF on the pipe handling stdout and stdterr, puppet ignores the EOF. This results in puppet rapidly looping over these system calls:
1359029 wait4(1359100, 0x7ffce8537cb8, WNOHANG, NULL) = 0 |
1359029 getpid() = 1359029 |
1359029 pselect6(7, [6], [], [], {tv_sec=0, tv_nsec=100000000}, NULL) = 1 (in [6], left {tv_sec=0, tv_nsec=99998955}) |
1359029 fcntl(6, F_GETFL) = 0x800 (flags O_RDONLY|O_NONBLOCK) |
1359029 read(6, "", 4096) = 0
|
There is no blocking in the loop, so puppet consumes 100% of a CPU core until the child process exits. Describe steps to reproduce… Use a manifest like /tmp/test.pp
$c1 = [ |
'/bin/bash', '-c', |
'exec /bin/sleep 10 >/dev/null 2>&1', |
] |
exec { 'c1': |
command => $c1, |
}
|
Then run:
time puppet apply /tmp/test.pp |
Desired Behavior: The timing output should be like:
real 0m13.554s |
user 0m2.857s |
sys 0m0.516s
|
Real time is expected to be high, due to the 10 second sleep, but user time should be relatively low. Actual Behavior: The timing output is:
real 0m13.486s |
user 0m11.048s |
sys 0m2.265s
|
Note the high user time; this is because puppet is busy-looping while the child sleeps for 10 seconds. I will submit a patch for this. |