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

Re: [PATCH v2] transport-helper, connect: add atexit handler to reap children on abnormal exit

From
Andrew Au <cshung@gmail.com>
Date
Mar 11, 2026, 18:19 UTC
Message-ID
<CAGVkMb6M2buc5zS+SFfYa6LLs7fN369MrVagETVg0U_PN7njOg@mail.gmail.com>
In-Reply-To
<xmqqsea6p7st.fsf@gitster.g>
Thank you for the feedback.

The use case is a long-running service running as PID 1 inside a container. The service continuously spawns git to detect repository changes — it is not a one-shot container where git itself is the primary process. Because the service is meant to stay alive indefinitely, any zombies git leaves behind accumulate over time rather than being cleaned up when the container exits.

In my specific case, I observed over 6,500 zombie processes before identifying this as the root cause. The blog post linked in the cover letter documents the investigation in detail.

The fix ensures git cleans up its own children on abnormal exit paths, which is the right behavior regardless of whether the parent is PID 1 or not.

On Wed, Mar 11, 2026 at 10:58 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
>
> Andrew Au <cshung@gmail.com> writes:
>
> > When git 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. When
> > git is PID 1 in a container, these un-reaped children become zombies.
>
> Could you tell me more about the real use case behind such a set-up.
>
> These children become zombies, and then what will be done to the
> container that lost the "git" process, running of which presumably
> was the primary reason why the container was brought up in the first
> place?  Wouldn't these zombies go away when the container that
> finished its sole purpose of running "git" gets dismantled?
>
> Thanks.
Previous: Junio C HamanoNext: Jeff King
Message 7 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.