Article View: linux.kernel.git
Article #1819Re: [PATCH] sigchain: recover from concurrent double-pops of the same signal
From: ian4hu
Date: Thu, 29 Oct 2026 14:15
Date: Thu, 29 Oct 2026 14:15
56 lines
10573 bytes
10573 bytes
Hi Phillip,
Thanks for the follow-up. All three points make sense; let me
confirm what I plan to do so we are on the same page.
On SIGPIPE: you are right that my wording was wrong. Blocking is
not ignoring, and the write() fails with EPIPE either way. What
changes is that the signal is not delivered while it is blocked;
and since a SIGPIPE raised by a write is thread-directed, it stays
pending on the writing thread instead of being picked up by the
main thread. If that thread never unblocks it, it is never
delivered, so a worker that blocks SIGPIPE simply stops dying of
it. I left SIGPIPE out precisely to keep the "upstream of a pipe
dies of SIGPIPE" behaviour that common-init.c restores. The set I
plan to block is SIGINT, SIGHUP, SIGTERM and SIGQUIT. If you
think SIGPIPE belongs in it too, I will add it.
On the blocking pattern: agreed. I will block once around the
spawn loop and restore before the join loop, rather than around
each pthread_create(), via a small guard pair
struct signal_mask_guard guard;
block_sigchain_signals(&guard);
for (i = 0; i < nr_threads; i++)
pthread_create(&t[i], NULL, fn, &data[i]);
restore_sigchain_signals(&guard);
plus a git_pthread_create() wrapper on top for the single-thread
call sites. The loops I have in mind are preload_index(),
index-pack, pack-objects, grep, name-hash and the read-cache entry
loader; the fsmonitor--daemon and simple-ipc threads I would leave
alone for now, as they have their own lifecycle and signal
handling.
On sigaction: agreed as well. The handled signal is deferred by
default, so the remaining hole is a handler being interrupted by
one of the other common signals that share the same handler. I
will set sa_mask to sigfillset() and save/restore the whole
struct sigaction, so pop() does not clobber the caller's
sa_flags/sa_mask.
The one gap I cannot close is a thread created by library code
rather than by us. libcurl's threaded resolver is the case I am
aware of, depending on how libcurl is built; I do not know of an
in-tree instance, and I will mention it in the cover letter rather
than claim it is covered.
So I will drop this patch and build the series along those lines.
As you suggested, I will wait a few days for Peff and Junio to
comment before spending much time on it; if nobody objects I will
send the replacement as v2.
Thanks,
ian4hu
Technical Details
Message-ID:
<20261029141521.164544-1-hu2008yinxiang@163.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73775-linux-kernel-git=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73775-linux-kernel-git=dewy.ru From: hu2008yinxiang@163.com (ian4hu) Newsgroups: linux.kernel.git Subject: Re: [PATCH] sigchain: recover from concurrent double-pops of the same signal Date: Thu, 29 Oct 2026 22:15:21 +0800 Organization: Usenet Network Message-ID: <20261029141521.164544-1-hu2008yinxiang@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2024057"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:/uketm9LKH6XXJfqYXiruJxrs3w= sha256:jJhRn/hz/sgurhlxdf1XcJlxsmqoHclw+K6Utk8Ca5E= sha1:nEr1zU1VVsR0V+tibnOmFWTWtFs= sha256:uo3xNqlczkRyZ5I7iOBLJQ2jC05hBguHU5BXLHYIb70= List-ID: <git.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 9C5A2125C68; Thu, 29 Oct 2026 17:16:33 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.047 X-Spam-Status: No, score=-2.047 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=163.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Sd8wuZD5X3es; Thu, 29 Oct 2026 17:16:31 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=git+bounces-73775-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=163.com X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id B7D37125C67; Thu, 29 Oct 2026 17:16:22 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id B5E6D600EE6; Thu, 29 Oct 2026 14:16:14 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1793283373; b=IEku++gVCgsdacjSdxoDEaB4/4V+NStdPtEqPhQ9f39s/VYhESJNKdAxoNqQDQT7+3lB +yI2mmjzYNndVegrlSh2osf3cRsCJSjfneMyznkXGuwtcBiUvAGtag6xjYqGCSANlY4m+ 3+GnQBezJNl5XejkCgZDXbZKGb2F/arZSYlbYVaLrCIgSnkliN4MWZ1AEahYS9KdqZ7OQ rGTWCxidVG724oa5QH+eG5DM/0WLEiAb8x5Hw8nxdxcpeZfG7lF5BkjC2Lrh2GpcRxZAH M5awLs6vnTEyARm+/skEGLsNr/UnJiHkjvBTcNHBjh1IvPDQWHMbfdvPjzaL+cTWP0g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793283373; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Transfer-Encoding:X-CM-TRANSID: X-Coremail-Antispam:X-CM-SenderInfo; bh=rI9Nl1ZRlvvzhtH0grSrahQNCseoQcwaGaA4H0SzSag=; b=QiJ7BLSCiwC3IBav5kJvcEPyxz7tI5D//zq+U3LOemNNvIilqRlhoPveXCYAJhx1W3eD +lJKwo3tIx9dqcHBLy7gxdySWQ7CXXNE7BDygn9jFmeFTKq47QC3PVDTmEPR2TKKDgjzd Qe5sAR/PcQnr73n/lYVGLXP8cAEagLyYfJFSR5lT3tdJnGIktApX1vx1+TxbBblcwUEd0 iWBN2Se+K6iFhu+1dHZwX3piQIPCi8fpSa3L1j0wF1Ws17GQQ2VicqAAuB/60G4GrXSEX sYY3/hnk/YmzQBm0NKUdVtU8H+Y+a//UqMYjriFOHck7GaK6DwMW+bJ0QKDnB/Yo+UQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b="J/t3i8h/"; dmarc=pass header.from=163.com; spf=pass smtp.mailfrom=163.com; arc=fail smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5518606A321; Thu, 29 Oct 2026 14:16:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=J/t3i8h/ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=117.135.210.5 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793283372; b=NbGptNRMOU9uO3AA6xSqTvcSk247acgmWb5yOLXN0wv9Fj1VMtH8pdD1SCtcoAgY1N+V VWf7iUn4qtZdp8RuT4iaDpbIsCpP1Hy2YObTls7NYzwnOb8IcWiMgr0/3cs7Rwp8Q4a0x +kGZfwINrRT/40hMEIyYC4KkYpn1Q4HiPFgoxIXQqTC213E8OCjgHWRvt5V2CWZNjDK18 jX8GgGgNk58mHepNZTXyl9gYeuk1gt+kOL/tgnJdZBTrglYE6/Ee3uSb/HKLUxzhdjYxG fQqXSIrKHzGVDq6gfTJ3asHJieD04Wyimzazre/59OYtC72lE+YBsgiLAB/J8RtF0Fw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793283372; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-CM-TRANSID:X-Coremail-Antispam:X-Originating-IP:X-CM-SenderInfo; bh=rI9Nl1ZRlvvzhtH0grSrahQNCseoQcwaGaA4H0SzSag=; b=hKmYrwXZwuPZPSLmj5EVcKjSkT++5vypYamjr/3V1Qg5KkiJnbZj3506ealUwMuTFIgC ywHfPLov6vzGUWAef8thBowxDtm2JnDB9heRVnLkyAaTHJsLL9rWwvDKYmaJH85P5BYs8 GrhuSQDh7KqspNd3pPtY6pdXGayTeY3lCc8WBvC0j+RuHtyq+Z9QRipHNabufLxAA5vcc uMejPtaLq13C2OtZP0BqkkNCmcxfcjIi2IJ+KSSY/oCy015GYsyPvmwGEpa9UeSx5qpNN Xru+nwnBbhS38U9on9S3NgjWaoiCTkMsjywZuSqp982i7U1kT5qV8cioEkEXKVMnzXQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b="J/t3i8h/"; arc=none smtp.remote-ip=117.135.210.5 X-Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CEC4606A31A for <git@vger.kernel.org>; Thu, 29 Oct 2026 14:16:09 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9CEC4606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=rI 9Nl1ZRlvvzhtH0grSrahQNCseoQcwaGaA4H0SzSag=; b=J/t3i8h/3Hx/YcDvil 7UG+SzmBqPTVjoDmVUZT8Y4vmvYR/qwoJ4Or3VHmnFswhNHlamojK0YXDQdDv/H+ 1s+NxMyBx/jAZH2l9WqdgV57QUJUW5jmzNQgyKo2PUKYJzzbBez0Twxd44uQpN4a untjJRHhebkAQcIbr/NyhqRgk= X-Received: from mbp-home.softshell-mine.ts.net (unknown []) by gzsmtp5 (Coremail) with SMTP id QCgvCgCHgJH5VONqe_ApCw--.34741S2; Thu, 29 Oct 2026 22:15:21 +0800 (CST) X-Cc: git@vger.kernel.org, gitster@pobox.com, hu2008yinxiang@163.com, peff@peff.net, phillip.wood@dunelm.org.uk X-Mailer: git-send-email 2.53.0 X-Mailing-List: git@vger.kernel.org X-List-Post: <mailto:git@vger.kernel.org> X-List-Help: <mailto:git+help@vger.kernel.org> X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:git+owner@vger.kernel.org> X-Precedence: list X-CM-TRANSID: QCgvCgCHgJH5VONqe_ApCw--.34741S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Zr47Xr13GFyrJF15tF13urg_yoW8KrWkpF Z0qr1qyrZ7GFyxuFyDZa18GF4fArZ3uFs8Gr98G348A3y5Ww4SkrySya1YvFW5Ars7W3Wj vFsY934DJFWDtaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRGsj8UUUUU= X-CM-SenderInfo: dkxsiigy1l05pldqwqqrwthudrp/xtbC7hrmgGrjVPpJmgAA3m