Re: [RFC PATCH] daemon: add a self pipe to trigger reaping of children
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 30, 2025, 15:16 UTC
- Message-ID
- <xmqqbjq55kf0.fsf@gitster.g>
- In-Reply-To
- <59087d2d-6034-44d4-9fa0-c51d4bd60683@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 12 quoted lines
>> An obvious disadvantage (at least of this implementation), is that it >> actually doubles the number of events that need to be handled for each >> children process on most cases (ex: when `poll()` gets interrupted) >> I suspect that if fixing that last race condition is so important >> with >> the current foundation, it might be better to reintroduce some sort of >> timeout to poll(), so that they will be cleared periodically. >> I had a prototype (only the bare minimum) that I thought was more >> efficient and that would instead remove completely the need for a >> signal handler which I would post (only for RFC) later. > > I'm not sure injecting an fd into each child process is a good direction.
Yeah, I thought that the "self pipe trick" (in the title) refers to the technique to have a single pipe for the daemon to talk to itself, so that it can write(2) into the pipe in non-blocking way upon signal and expect its select/poll to be able to notice, where it can reap the completed children, so having a pipe per child was a surprise to me.