git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:12 UTC

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

From
Andrew Au <cshung@gmail.com>
Date
Mar 12, 2026, 19:40 UTC
Message-ID
<CAGVkMb6eBWWo1bd_xLx6K9qAvhORVJtkoiFX+Z9X3sdYTcU+Uw@mail.gmail.com>
In-Reply-To
<abHbddcYKpW4hlMz@fruit.crustytoothpaste.net>

Thank you for the suggestion. You are right that tini is a common and reasonable approach, and I will look into using it regardless.

That said, I think fixing git to clean up its own children is still worthwhile — processes should not leave zombies on abnormal exit paths whether or not an init helper is present. The two approaches are complementary rather than mutually exclusive.

On Wed, Mar 11, 2026 at 2:15 PM brian m. carlson <sandals@crustytoothpaste.net> wrote:

Show 26 quoted lines
>
> On 2026-02-23 at 16:51:46, Andrew Au wrote:
> > 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/
>
> Usually people use a tool like tini as PID 1 in containers, which allows
> that process to handle process reaping while still exec'ing the normal
> Git or other command.  It's the case that _most_ processes are not
> designed to run properly as process 1 in a container or otherwise, so
> a specialized init-capable helper program is usually a good idea.
>
> Even with this series to fix some of the process reaping problems, I
> expect you'll find other cases in Git where we don't always reap
> processes correctly as well, so an init helper would still be useful.
> --
> brian m. carlson (they/them)
> Toronto, Ontario, CA
Previous: brian m. carlsonNext: Andrew Au
Message 11 of 22 in “Fix zombie children when git is PID 1 in containers”
  1. 0/1 Fix zombie children when git is PID 1 in containersAndrew Au, Feb 23, 2026
  2. 1/1 transport-helper, connect: add atexit handler to reap children on abnormal exitAndrew Au, Feb 23, 2026
  3. Kristoffer HaugsbakkFeb 23, 2026
  4. Andrew AuFeb 23, 2026
  5. transport-helper, connect: add atexit handler to reap children on abnormal exitAndrew Au, Mar 11, 2026
  6. Junio C HamanoMar 11, 2026
  7. Andrew AuMar 11, 2026
  8. Jeff KingMar 11, 2026
  9. Junio C HamanoMar 11, 2026
  10. brian m. carlsonMar 11, 2026
  11. Andrew AuMar 12, 2026
  12. transport-helper, connect: use clean_on_exit to reap children on abnormal exitAndrew Au, Mar 12, 2026
  13. Jeff KingMar 12, 2026
  14. Jeff KingMar 12, 2026
  15. Junio C HamanoMar 12, 2026
  16. transport-helper, connect: use clean_on_exit to reap children on abnormal exitAndrew Au, Mar 12, 2026
  17. Junio C HamanoMar 12, 2026
  18. Jeff KingMar 14, 2026
  19. Junio C HamanoMar 14, 2026
  20. Junio C HamanoMar 16, 2026
  21. Jeff KingMar 16, 2026
  22. Junio C HamanoMar 16, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.