Skip to content

Commit e444ba8

Browse files
steadmongitster
authored andcommitted
run-command: don't spam trace2_child_exit()
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6cd33dc commit e444ba8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

run-command.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,8 @@ int finish_command(struct child_process *cmd)
983983
int finish_command_in_signal(struct child_process *cmd)
984984
{
985985
int ret = wait_or_whine(cmd->pid, cmd->args.v[0], 1);
986-
trace2_child_exit(cmd, ret);
986+
if (ret != -1)
987+
trace2_child_exit(cmd, ret);
987988
return ret;
988989
}
989990

0 commit comments

Comments
 (0)