Commit 5c2e0ab
[1.2.x] fix: exec_with_timeout operator precedence, child kill, and stderr handling (Cacti#6732)
* fix: backport exec_with_timeout operator precedence, child kill, and stderr handling
- Fix operator precedence: `(int)` cast bound tighter than multiplication,
so timeout never decreased. Parenthesise the float expression first.
- Kill entire process group via posix_kill(-pid, 9) before proc_terminate
to prevent orphaned child processes when timeout expires.
- Log stderr as POLLER warning instead of discarding valid stdout output
by returning false.
Backport of fixes from develop branch fix/exec-with-timeout-bugs.
Addresses issues Cacti#6719, Cacti#6720, Cacti#6721.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix: use setsid for correct process group kill on timeout
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix: avoid process-group kill in exec_with_timeout
Use direct PID kill to avoid targeting unrelated process groups.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* fix: clarify exec_with_timeout kill semantics
Document why direct PID kill is used instead of process-group signaling.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent b514026 commit 5c2e0ab
1 file changed
+9
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
| |||
0 commit comments