Commit b52bc21
committed
ExternalProcess: don't kill the process group when a spawned command fails
Two bugs made a failed external command tear down the entire process group:
- The fork child threw cRuntimeError when execvp fails. In the child (a copy of
the sim process) that unwinds into a full simulation teardown, running
~ExternalProcess() with pid==0 -> stopProcess() -> "/bin/kill -SIGTERM 0",
which SIGTERMs the whole process group. A1: report the errno on the redirected
stderr and _exit(127) instead of throwing, so the parent just sees the process
exit and applies its onExit policy. Use _exit (not exit) so the fork child never
runs the parent's atexit/static destructors.
- stopProcess() guarded only "pid != -1", so pid==0 (or any non-positive value)
would issue "kill 0" / "kill -1" against the process group. A2: guard "pid > 0".
Surfaced by CI: running INET's module suite concurrently under a single podman-exec
process group, a missing external tool (ping/killall absent from the container)
tripped this and SIGTERM'd the whole run (opp_env included -> exit 143) at ~140/321.
With this fix a missing/failing command fails only its own test.1 parent 9097c7b commit b52bc21
1 file changed
Lines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
118 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
| |||
135 | 149 | | |
136 | 150 | | |
137 | 151 | | |
138 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
139 | 156 | | |
140 | 157 | | |
141 | 158 | | |
| |||
0 commit comments