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