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

Re: [PATCH] sigchain: recover from concurrent double-pops of the same signal

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Oct 28, 2026, 14:29 UTC
Message-ID
<3f939144-d4b3-4bc5-aaea-16422450d638@gmail.com>
In-Reply-To
<20261028133755.112476-1-hu2008yinxiang@163.com>
On 28/10/2026 13:37, ian4hu wrote:
Show 8 quoted lines
> Hi,
> > Gentle ping on this one.  It is queued in 'seen' as
> iy/sigchain-recover-concurrent-pops, and the latest "What's cooking"
> marks it as "Needs review".
> > A short recap: when two copies of the same signal reach two threads
> nearly at the same time, the concurrent sigchain_pop() calls in the
> handlers can unwind the chain by two levels instead of one, leaving
> the process spinning in a handler that keeps re-raising the signal.
It sounds to me like the bug is that we're unwinding the same chain of signal handlers in two different threads at the same time. Doesn't that mean we're potentially calling the same handler twice, once from each thread, which doesn't sound like it'll lead to anything good. I wonder how hard it would be to fix the code to ensure that signals are blocked when we spawn a new thread so that they are only handled in a single thread. It would probably be good idea to start using sigaction() as well so that we don't interrupt a signal handler if we receive another instance of the same signal while the handler is running.
Thanks
Phillip
Show 15 quoted lines
> This is reachable with "git clone --depth 1" over ssh receiving two
> SIGTERMs in quick succession, and only SIGKILL gets rid of the
> process.
> > The patch leaves the push/pop fast path alone and only teaches the
> "n < 1" guard in sigchain_pop() to fall back to the pre-chain
> disposition, so the stuck handler's raise() terminates the process
> just as a single delivery would.
> > Peff, I have Cc'ed you since you wrote the sigchain code.  I would
> appreciate your thoughts on whether this "repair after the fact"
> approach is acceptable, or whether you would rather see the chain
> mutation serialized instead.  I also have a version that uses a
> per-signal spinlock around push/pop, and can send it if that is
> preferred.
> > Thanks,
> ian4hu
Previous: ian4huNext: ian4hu
Message 3 of 6 in “sigchain: recover from concurrent double-pops of the same signal”
  1. sigchain: recover from concurrent double-pops of the same signalIan Hu via GitGitGadget, Oct 16, 2026
  2. ian4huOct 28, 2026
  3. Phillip WoodOct 28, 2026
  4. ian4huOct 28, 2026
  5. Phillip WoodOct 28, 2026
  6. Phillip WoodOct 29, 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.