]> git.ipfire.org Git - thirdparty/git.git/commit
Revert "transport-helper, connect: use clean_on_exit to reap children on abnormal...
authorJeff King <peff@peff.net>
Wed, 22 Apr 2026 23:00:20 +0000 (19:00 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Apr 2026 23:31:41 +0000 (16:31 -0700)
commit8b44deebaf02246b40c267c06bf0c74ef71df292
tree86c3405a883c1064b9fbdc5dfa5bf132420ed7ef
parent87972f30017cc82ea9bab8e20e85bcf1fe84e1d2
Revert "transport-helper, connect: use clean_on_exit to reap children on abnormal exit"

This reverts commit dd3693eb0859274d62feac8047e1d486b3beaf31.

The goal of that commit was to avoid zombie child processes hanging
around when the parent git process is killed. But it doesn't quite work
when the child command is run by the shell:

  1. If there is a shell, then we kill and wait for the shell, not the
     process spawned by the shell. And so the child process, even if it
     eventually exits, will hang around as a zombie forever. And this is
     true of most (all?) shells: bash, dash, etc.

     So we are not really accomplishing our goal in the first place.

  2. Not all shells will exit immediately upon receiving a signal. In
     particular, mksh will wait for its children to exit (but not
     actually propagate the signal to them!) leaving us with a potential
     deadlock: git is wait()ing on mksh, which is wait()ing on a child
     process, but that child process is waiting on git to produce more
     input (or EOF) over a pipe.

     You can see several examples of this deadlock in the test suite,
     for example by running:

       make SHELL_PATH=/bin/mksh
       cd t
       ./t5702-protocol-v2.sh

Because this is a regression for mksh users, and because we did not
achieve our goal even with other shells, let's revert the commit for
now. If there is a more clever way of doing the same thing, we can
consider applying it separately on top (or do nothing and just accept
the zombies and rely on PID 1 to reap them).

Reported-by: Jan Palus <jpalus@fastmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connect.c
transport-helper.c