[PATCH] run-command: don't spam trace2_child_exit()
- From
Josh Steadmon <steadmon@google.com>
- Date
- Apr 28, 2022, 20:58 UTC
- Message-ID
- <4616d09ffa632bd2c9e308a713c4bdf2a1328c3c.1651179450.git.steadmon@google.com>
In rare cases, wait_or_whine() cannot determine a child process's exit status (and will return -1 in this case). This can cause Git to issue trace2 child_exit events despite the fact that the child is still running. In pathological cases, we've seen > 80 million exit events in our trace logs for a single child process.
Fix this by only issuing trace2 events in finish_command_in_signal() if we get a value other than -1 from wait_or_whine().
Signed-off-by: Josh Steadmon <steadmon@google.com> --- run-command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/run-command.c b/run-command.c index a8501e38ce..e0fe2418a2 100644 --- a/run-command.c +++ b/run-command.c @@ -983,7 +983,8 @@ int finish_command(struct child_process *cmd) int finish_command_in_signal(struct child_process *cmd) { int ret = wait_or_whine(cmd->pid, cmd->args.v[0], 1); - trace2_child_exit(cmd, ret); + if (ret != -1) + trace2_child_exit(cmd, ret); return ret; } base-commit: faa21c10d44184f616d391c158dcbb13b9c72ef3
-- 2.36.0.464.gb9c8b46e94-goog