Article View: linux.kernel.git
Article #1023maintenance: stale maintenance.lock after the detached child is killed silently disables auto-maintenance (more likely since 2.5...
From: Masaya Kazama
Date: Wed, 21 Oct 2026 10:16
Date: Wed, 21 Oct 2026 10:16
102 lines
16012 bytes
16012 bytes
[Resending as plain text; the first attempt was rejected by vger for
containing an HTML part. Sorry for the duplicate to those on Cc.]
Hi,
Since 6e95b07e5f (builtin/maintenance: fix locking with "--detach",
2026-05-13), the detached "git maintenance" child owns
objects/maintenance.lock until its background tasks finish. If that
child is killed in a way that skips the tempfile cleanup (SIGKILL,
power loss), the lock stays forever. Every later
"git maintenance run --auto" then finds the lock and returns without
running anything and without any message, so auto-maintenance stops
for good and nobody notices.
The stale lock itself was reported in 2024 [1], where Stolee called it
"unfortunately a common occurrence". What is new is that 6e95b07e5f
extends the window in which the lock is held from the foreground phase
to the whole background run, so a kill during the (possibly long)
background tasks now leaves the lock behind. Before 6e95b07e5f the
parent removed the lock when it exited right after daemonizing.
Reproduction (git 2.56.0 on macOS; same FIFO trick as Taylor's test in
the "fix locking with --detach" discussion [2]):
git init -q repro && cd repro
git commit -q --allow-empty -m base
git config maintenance.auto false
git remote add origin /does/not/exist
git config remote.origin.uploadpack \
"echo \$PPID >\"$PWD/fetch.pid\" && cat \"$PWD/fifo\""
mkfifo fifo
git maintenance run --task=prefetch --detach
while ! test -s fetch.pid; do sleep 0.1; done
daemon=$(ps -o ppid= -p "$(cat fetch.pid)" | tr -d ' ')
kill -9 "$daemon"
: >fifo
ls .git/objects/maintenance.lock # still there
GIT_TRACE2_EVENT="$PWD/trace" \
git -c maintenance.loose-objects.auto=1 \
maintenance run --auto --task=loose-objects
grep -c '"region_enter".*"category":"maintenance"' trace # 0
git maintenance run --no-quiet --task=pack-refs
# warning: lock file '.git/objects/maintenance' exists,
# skipping maintenance
After "rm .git/objects/maintenance.lock" the same --auto run enters one
maintenance region. With Apple Git 2.50.1 (before 6e95b07e5f) the lock
is already gone while the detached child runs, so killing it leaves
nothing behind.
How I hit it: in one large partial clone (blob:none, ~425 branches)
the lock was created on 2026-06-30, a few minutes after I upgraded to
2.55.0, and stayed until I found it on 2026-10-21. I do not know what
killed the detached child; no git crash reports exist for that day.
During those four months a GUI tool fetched the repository every
minute; the pack count grew to 3,550 and the packs to 13.9 GB. Almost
all of it was duplication: "count-objects -v" reported 94 million
in-pack entries, but only 1.46 million remained after a manual
"git maintenance run", which brought the packs down to 0.68 GB (GitHub
reports about 0.4 GB for the repository). The commit-graph stayed at
its April state, which made "git log --topo-order" over all refs take
seconds. Two other repositories on the same machine had the same stale
lock, created on 2026-09-29 and 2026-10-04; both are regular
(non-partial) clones, so partial clone is not a condition; it likely
made the packs pile up faster, since every promisor fetch is kept as a
pack. Other projects report the same symptom, e.g. [3] (auto gc
"silently disabled for a week") and [4].
A note on core.lockfilePid: it cannot simply be used to detect a stale
maintenance.lock. With 2.56.0 and core.lockfilePid=true, while the
detached child is alive, maintenance~pid.lock contains the pid of the
parent, which has already exited. A liveness check based on that file
would treat a live lock as stale.
Some options, roughly from least to most work (I have not tried to
implement any of them):
- When "maintenance run --auto" skips because of the lock, leave a
trace that a user can find later (for example like the gc.log that
a daemonized "git gc --auto" leaves), instead of returning silently.
- Record the pid and hostname of the actual holder (the detached
child) and ignore the lock when that process is gone on the same
host, like lock_repo_for_gc() does for gc.pid.
- Use an OS-level lock that is released when the process dies, as
suggested in [1].
Thanks,
miyaoka
[1]
https://lore.kernel.org/git/CAN477tHJnVnOKfUsG5G9QAVdzYvmUuC8A8Vxt8mtHB23fd=hAQ@mail.gmail.com/
[2]
https://lore.kernel.org/git/20260511201049.GB22912@coredump.intra.peff.net/
[3] https://github.com/craigoley/remudero/pull/9555
[4] https://github.com/solidDoWant/vault-sync/pull/115
Technical Details
Message-ID:
<CAEdWB0ChxOZUszwDVqWY3jdvGpNtV9NRTG8_X1-f2PX9QnJQTw@mail.gmail.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-72700-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-72700-linux-kernel-git=dewy.ru
From: miyaokamiyao@gmail.com (Masaya Kazama)
Newsgroups: linux.kernel.git
Subject: maintenance: stale maintenance.lock after the detached child is
killed silently disables auto-maintenance (more likely since 2.55)
Date: Wed, 21 Oct 2026 19:16:48 +0900
Organization: Usenet Network
Message-ID: <CAEdWB0ChxOZUszwDVqWY3jdvGpNtV9NRTG8_X1-f2PX9QnJQTw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: usenet.network;
logging-data="4106609"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:bSf9sBvJPjA8GoOnTB/b74JkDq8= sha256:VUS7jHaK4pGuryuzhga0V9wNCDOpLfnWu8VtGXwXI7k=
sha1:kkYyblQUxk2S/iu36p+Qq5CRozE= sha256:9NouNO7dFMxk/KQ9gHImcLJ1d8I0hT+A67ZbmUIG8bk=
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 199E8110FB0; Wed, 21 Oct 2026 13:22:18 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.047
X-Spam-Status: No, score=-3.047 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.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, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.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 50IBmGVkcGKM;
Wed, 21 Oct 2026 13:22:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-72700-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id AB0EC110FAB; Wed, 21 Oct 2026 13:22:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id D514847EA2; Wed, 21 Oct 2026 10:17:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1792577823;
b=SfYmwjQIMQ8164jnTsyIEX1WkdSv+CQCFG+L6Sdf5QMlX96ANpAIPqf1m5kq9cy7gylU
Uo2oMJHL9xAcqRRN1FSS0YB/JNKEYx9T51kPUrCDMQckwcLxSBrK6xqBEKaxg3JrZZrHe
6PRWmTd9XhmdRr16yV04sMyriQmWXEJ15470kxYeJb5MMCIuHZz59xyP+KQ7qcJ7scYzV
CKkl6PpqZn9jxNpqa+NAYE1GeS944NHI07SjQP8xlP2G0rVrKC//dH9ZdQ6gRrJMHAQwJ
sULT+6D33tCdPB/l0od4qMjUfl2KME61Mn03v+0TPLKxWc1LvcfLth7RFvPwJyEwc2g==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792577823;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:From:Date:
X-Gm-Features:Message-ID:Subject:To:Cc:Content-Type;
bh=s3Fj8YjPSTupXjt++Rpzf/NllSuxV3tkJe41ws9RWGQ=;
b=u4vKfGqN27sk+E2/uWTyCyVfOzmHOgn+y2yNgo9mKqjOlRGvZGTpMMib9Tw+B9DnyM6r
KEjRWMZEulB3swcYTfg4MoOgTJvZctvwWs3j7wF1XF2l3sjHdPVZE24KvDU7StG65ipkg
T0dxbZJi7WNr7RYOmgyzY5ex2tqmg5oCbNYjiPebjHQKAFiX2HvQT1jru9j8lNW6+Pj+H
MLl34uwGbZXUiAEkp87Psd0GmIETmWxeAkAh+DNY2OsatNz677IDwvZtkK3KLIGiF6870
wnkajITYiK8B427Vkc2H6Kxw2kw1AflChfmDjddnJrVxvFymsruxsW3K1lgElC1WNWw==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=AFLHt23S;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 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 ACA8F606A321;
Wed, 21 Oct 2026 10:17:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=AFLHt23S
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.160.44
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1792577822;
b=pWxT9KdEM8nH1rupqqUN7/xpsOhufcMRfZayv7E2esJhGwF/YcLjkIobYvXBIJiXtXVi
5rD3vhdTQBydkTRCJyahnAJd/thDZ3fxaVFiUuGTqQNPVSJw8uZEvAfUdGE4svbSJRjsQ
rzrwpM/Q7CLoES+T/eizax7vTiHnXDDt1/Q7HkKr+DnNhKopCrQhDmteB1OLRnjJwaulO
oUjXonfKuD+MKx87hjzMiUrvkt+mjliPJlwbXrlp+fantfXseL5+GRlEigCLVjcspiwoH
JQk35LWYtyJ3VWPbu6t4cA1o+HBfZnqdZZ0oBz1vJlxN5Wjn4TeFFagwfjasq+OBnlw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792577822;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:MIME-Version:From:Date:
X-Gm-Features:Message-ID:Subject:To:Cc:Content-Type;
bh=s3Fj8YjPSTupXjt++Rpzf/NllSuxV3tkJe41ws9RWGQ=;
b=efalYuIMnha7gRzUnrpRh+ZdydjlCZr+vIYu0p0BgQQ+HCHx16oqa0XKfmpJShYZsnPH
KUj7NPmNr8ABrEuiZOk1uOLfuxeNGU/vDRDz6rgeCgzxjYZSoqV/FGHQTItuZwKUqW/Fe
EcwrEsY82H3AYeBcRz31Vhjx5avm9KYHxegpbo4ewdUfztIhTl1G0++ehzF/XsUCmZuZQ
aoh6Pi79SSMsDn05zrOp/kfSoHyXHxq4UU0vvO3IwBBIp3KoBQIXRlv3GtdOScBBvZ28n
4/7AeWX3ZiojlBWjSzKgtNi6lKU28qDxJSM91ayDufdcXfemJYLHsa9TeJgi8qQyQAg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=AFLHt23S;
arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.160.44
X-Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BA8E606A31B
for <git@vger.kernel.org>; Wed, 21 Oct 2026 10:17:02 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6BA8E606A31B
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-499f20c7054so324789fac.0
for <git@vger.kernel.org>; Wed, 21 Oct 2026 03:17:02 -0700 (PDT)
X-ARC-Seal: i=1; a=rsa-sha256; t=1792577821; cv=none;
d=google.com; s=arc-20260327;
b=FC6BlEHcvEpDcPG40qpNrkW7D62JNQ5jjh0voQwRAh7XuglHgqZbOLGKB5x1YzUylU
B+efb+mALg+plp2X7jWcS0xpX6E69oR3l7/zIk+J6mjkMzJCQYYL3uDsL9vCrpYExIIb
TjhZe7cCVmuYdSmHQigJnacSyb99A0rb9PvG/0s1Z/WLcE9we7y1rmUI276K+Vbb/E7T
YZasC7WofTmFWbCTlVWWCyJtel7/A7xTDuJzwI3JkmEuZT3gUnHNJGNkuSBHO3YVdvfe
NDmoNLj9kl2Cx6o0BtuG1o3kqiAmPgbuxsZbcDflfJkGwVHadpmp7mfxZPp6p8zvmfQU
yMYw==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=cc:to:subject:message-id:date:from:mime-version:dkim-signature;
bh=s3Fj8YjPSTupXjt++Rpzf/NllSuxV3tkJe41ws9RWGQ=;
fh=vZuVgrM2LTXIgjvGDmtDKG97BDUBBwkhOkEbhTFC0+A=;
b=TGq4BzaVkluTUnrpBWR5Ch57AX79vQoIS+B0EAYHE3y7NEkyB6JqTI40HDGe9LW/yK
aXmizJ7swN30MQwQd1ubxJSyVjsXbuFbGiQCY8oo3VdvefCDX60D3/ojgbk7K+1cOxxo
0BDCYCuKrvM+dEJ6DjpAGj1Apq9njUtHLEv46VQcInjyhe+cCO6I4p7g4gF5s7yHrLRE
dmlM4e+Ul3PJId4mYes/bvXpYyZO81/+IBvsBrkzo345mvh3pT2xOZ03DAXKLNJk3q4V
+mf2h0DQVNc8A8BXn308M5mBRytm+FAQq/EeieBJ261kuIGuxj52AuLse8prLI+QzXvt
zOlQ==;
darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792577821; x=1793182621; darn=vger.kernel.org;
h=content-type:cc:to:subject:message-id:date:from:mime-version:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=s3Fj8YjPSTupXjt++Rpzf/NllSuxV3tkJe41ws9RWGQ=;
b=AFLHt23SaoD8GZPhUl+oXa6dKBY6Tx2gjP4aMDiM1MyRlg3RXQw7wAB3xEXvoGQzDl
VFUTH7B0q2DqxpQhqCwbnbzWlAFMHD9Rezzwzactv4p6/w/+j8lhln5sWdoFCIIj/a55
XNpYi+f9smer++fQ535ulU1UhMuelubO+DYEaGvdR9rH7ckQqf3WZsiWwa0Ejat1Tld1
tOrScj6eSVwCR+oE1SeY+tJQNRVj5Uz8FaHFA4kf4QyhvKmNDQZzTt4o1paF5fpV2V7A
Umt6F3JY/o5rABruAO3cbywlXr1ki53e0uP1Oo0NhQ8AW1VjdAHRyHiR6fUmYVYDJaiR
wyLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792577821; x=1793182621;
h=content-type:cc:to:subject:message-id:date:from:mime-version
:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to:content-type;
bh=s3Fj8YjPSTupXjt++Rpzf/NllSuxV3tkJe41ws9RWGQ=;
b=etx6lR7z2/FitK90AT+6a/7mWqIk+DVLWqp5ThWJ6o1UPuoE2kCctHAa2yK1ydbF/v
LiA+auL1n76LjMbig+c8Kli8PKw9fOSbFtyngwEA8DGCQXmk5FyMyhuu9KOiWrFNLX/m
n9MDKgo7Bc5Gt7PJ1ntYpoQrOPQ3KXRA+FRYJxzHOxez+Tiwebfk0/bZEz/6Wpi2F1Wd
LZVTYhFHkLBIfLxyEcUKJNyTDyQGneURUUSYcVpkMMo9wTUDAq4VedUP+M56JKYxz/VV
aDlF25IF26QiXJRsfLimOaYfPxT73UEpn2tU9+UP8+ab3NgGRIgw1+xg2A+W9FD3cbbU
8S1g==
X-Gm-Message-State: AFq9FYJsHftjCe+yw2pnRX1RoeKeRAwl8Y+F+hundnH1orgvjxyoNZjQ
DIU2P6vSOlSPRhPNNH4awezdxeJNZGn9vkbFdOpDrMqzTd1CKjBufn3/TpHtx/mr+LUoUqsBOBi
bjwZh/D7VFZbHzw3xmkskrZseDI/whVKPY0O2
X-Gm-Gg: AYBFou0C8AIvWRG+9bg5nbFjxFH0q0QLFDVa+T/lESygux6FW0mTUB+iTgMDoW39cyl
HPomwdIjd51H9jwTFiLlc25cn3Jf44R9pEK2FKIOueVALUcFcOBwYPyzni9AO01KTMHaDV5Cl6E
bAFIOwnFYp4+burBd3N9qOJRrf3rcX3YeiJkbXgtN4BS/t4t+hOpOxMCL3+nrPa7KEal/8xTpiG
cgfuVt5WV/9vps13otPZXhFZfrK20rk7Jn5xV97rrXjYQhuWrFZ+wIdcZDygPXb6B1PfLbNdD9Q
RnhBSbrvxqVLzBZckQZW2mFWcT7vUacNlBAp5+z4vsdCumlpueTfivJr4ahtqnHJjmwkqtIzg8I
57b5QassXYxnXLF6xJOjAw8xcK9eSmKxNkM0OUA1aEHdHiXwbpGqs5A98TGwBs+0=
X-Received: by 2002:a05:6870:334d:b0:48f:e107:3179 with SMTP id
586e51a60fabf-4a7dc27e1a4mr878756fac.44.1792577821133; Wed, 21 Oct 2026
03:17:01 -0700 (PDT)
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-Gm-Features: AclHuK9_B4m4fDrrbhzYFe1msweJnkcG_9_o-vdiCwx9eT7EpD0BG3H7QOCGmvE
X-Cc: Patrick Steinhardt <ps@pks.im>, Taylor Blau <me@ttaylorr.com>, Jeff King <peff@peff.net>,
Derrick Stolee <stolee@gmail.com>, 刘钟博 <liuzhongbo.gg@gmail.com>