Subject: [PATCH 0/1] Fix zombie children when git is PID 1 in containers

From: Andrew Au <[email-masked]>
Date: Mon, 23 Feb 2026 16:51:46 +0000

When git runs as PID 1 inside a container and exits via exit(128) on
transport errors, child processes (git-remote-https, ssh, proxy) are
never waited on because the normal cleanup paths (disconnect_helper,
finish_connect) are bypassed. Since PID 1 has no parent to reap its
children, these become zombies that persist for the container's lifetime.

This patch registers atexit handlers in transport-helper.c and connect.c
to ensure children are reaped on any exit path, and clears them on the
normal cleanup paths to avoid double-waiting.

Blog post with detailed investigation: https://cshung.github.io/posts/zombie-git/

Andrew Au (1):
  transport-helper, connect: add atexit handler to reap children on
    abnormal exit

 connect.c          | 17 +++++++++++++++++
 transport-helper.c | 11 +++++++++++
 2 files changed, 28 insertions(+)

-- 
2.43.0