git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] transport-helper, connect: use clean_on_exit to reap children on abnormal exit

From
Jeff King <peff@peff.net>
Date
Mar 12, 2026, 20:40 UTC
Message-ID
<20260312204023.GB2552877@coredump.intra.peff.net>
In-Reply-To
<20260312195813.4006430-1-cshung@gmail.com>
On Thu, Mar 12, 2026 at 07:55:59PM +0000, Andrew Au wrote:
Show 5 quoted lines
> Set clean_on_exit and wait_after_clean on child_process structs in both
> transport-helper.c and connect.c so that the existing run-command
> cleanup infrastructure handles reaping on any exit path. This avoids
> rolling custom atexit handlers that call finish_command(), which could
> deadlock if the child is blocked waiting for the parent to close a pipe.

Ah, right, I forgot about wait_after_clean when I suggested clean_on_exit. Yes, you definitely want both here.

Show 7 quoted lines
> The clean_on_exit mechanism sends SIGTERM first, then waits, ensuring
> the child terminates promptly. It also handles signal-based exits, not
> just atexit.
> 
> Signed-off-by: Andrew Au <cshung@gmail.com>
> 
> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

I don't know if we have established a pattern in the project for AI-assisted work (and whether it is worth marking at all, and if so, if co-author is the right way to do so). But if we are going to, usually the trailers would all be together, with no blank line in between.

>  connect.c          | 4 ++++
>  transport-helper.c | 2 ++
>  2 files changed, 6 insertions(+)

The changes here are all a trivial implementation of the idea. So if the idea is good (and I think it is), then the patch looks correct to me.

-Peff
Previous: Andrew AuNext: Jeff King
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. Junio C HamanoMar 11, 2026
  9. Jeff KingMar 11, 2026
  10. transport-helper, connect: use clean_on_exit to reap children on abnormal exitAndrew Au, Mar 12, 2026
  11. Jeff KingMar 12, 2026
  12. Jeff KingMar 12, 2026
  13. Junio C HamanoMar 12, 2026
  14. transport-helper, connect: use clean_on_exit to reap children on abnormal exitAndrew Au, Mar 12, 2026
  15. Junio C HamanoMar 12, 2026
  16. Jeff KingMar 14, 2026
  17. Junio C HamanoMar 14, 2026
  18. Junio C HamanoMar 16, 2026
  19. Jeff KingMar 16, 2026
  20. Junio C HamanoMar 16, 2026
  21. brian m. carlsonMar 11, 2026
  22. Andrew AuMar 12, 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.