Article View: linux.kernel.git
Article #4277Re: User-initiated recovery for stale index.lock
From: Tanga Joris
Date: Wed, 02 Dec 2026 21:52
Date: Wed, 02 Dec 2026 21:52
40 lines
13283 bytes
13283 bytes
Hi Steve, On Wed, 25 Nov 2026 at 16:07, Steve <steves.sk@gmail.com> wrote: > Since core.lockfilePid already tracks the PID, > why couldn't a manual recovery command perform that check itself and > remove the lock when explicitly invoked by the user, along with > ensuring that we wait for some reasonable time? Removing the file by > hand doesn't allow users to apply any safety checks. That's a fair point. A command could check things that removing the file by hand doesn't. The problem is that the check can be wrong. If Git is killed while it holds the lock, both index.lock and index~pid.lock are left behind. If you then remove only index.lock, the next Git process can't write its own PID file, because the old one is still there. So the old PID stays. I tried running "git commit" with the old PID file still there, and left its editor open. Then "git add" in another terminal said: Lock was held by process 99999, which is no longer running; the lock file appears to be stale So a command that trusts this check would remove a lock that is still in use. It also means index~pid.lock has to be removed together with index.lock. Waiting wouldn't help much here. If the lock is stale, it stays there no matter how long we wait. And "git commit" keeps the lock for as long as its editor is open, so a lock that is still in use can also be there for minutes. Also, the PID file doesn't say which machine the process is on. So if the repository is shared over NFS, a process on another machine that holds the lock can look gone from here. Thanks, Tanga
Technical Details
Message-ID:
<CAKrRMNo2wMmoQY0Cy9q3DgwUuTTZEFBm2un2Ut-F1LFneBoRWw@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76914-linux-kernel-git=dewy.ruReferences:
<CAAQS9U+Ht3x=V3e1XJT9V120Tj5jCuCMTrxTnZyzTpsg-G9uBQ@mail.gmail.com> <CAKrRMNpHHHHw3goFMwLKF2GRzQefcXJaXZcjY6yz_7QdbgJ_cA@mail.gmail.com> <CAAQS9U+76TGukWp+AMWN9CY_tU9kD_3Wzq9k7PzLnUqAd8SuhQ@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76914-linux-kernel-git=dewy.ru
From: tangajoris@gmail.com (Tanga Joris)
Newsgroups: linux.kernel.git
Subject: Re: User-initiated recovery for stale index.lock
Date: Thu, 3 Dec 2026 00:52:51 +0300
Organization: Usenet Network
Message-ID: <CAKrRMNo2wMmoQY0Cy9q3DgwUuTTZEFBm2un2Ut-F1LFneBoRWw@mail.gmail.com>
References: <CAAQS9U+Ht3x=V3e1XJT9V120Tj5jCuCMTrxTnZyzTpsg-G9uBQ@mail.gmail.com>
<CAKrRMNpHHHHw3goFMwLKF2GRzQefcXJaXZcjY6yz_7QdbgJ_cA@mail.gmail.com> <CAAQS9U+76TGukWp+AMWN9CY_tU9kD_3Wzq9k7PzLnUqAd8SuhQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: usenet.network;
logging-data="2069372"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Pm0WVDjnOOgXIzH0FXTSiiqUpls= sha256:q93WmuUWcrDuPO6sJqDBXo4FrkB8c4oCvCYhT7wuqjo=
sha1:n0HrcTD+0Oa4tXKUBfBiGo6gm2w= sha256:4JKq9nqDmNqFR3qu/JxK3PIwM9f4sukITumw59Jb9fg=
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 64230117745; Thu, 3 Dec 2026 00:53:48 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, 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.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-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 ptULIiIPouxJ;
Thu, 3 Dec 2026 00:53:41 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76914-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 46E44117741; Thu, 3 Dec 2026 00:53:32 +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 16B79251F0; Wed, 2 Dec 2026 21:53:30 +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=1796248410;
b=lNsyiM2ezakUgdWCNIj/qIkBfXWZ/DSMPTYfYoRxYX59m2C69Kd9thaenAzPaT/ffy6r
lMSNw6miqdoDisqNDnwau1eATTU8D78pH9q+99Ih5sBX9uQfTZCaY85Ju+wRVBBYQCszc
W4En2sD4ck4ZnhYspEmctKI9vA4nY6s/y5kWusSq3hjxKisZQnNJYoU89gxMD5gEC8Tar
Pgp+q6MC28vTiW8nfaO6BrumwRfCFDLfjxEXzf9gWHMnc1b/d/fC5Au5thkfv0HhVx4vM
DOnkgvLeBEW89ZKLgDqxANAQZ1KOYNA0+Fn9d/eBDP2a/uzY27P1k2EVaQcfX7XKCCA==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796248410;
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:References:
In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type;
bh=Qk+SGiEpWZ2D1VdTAtViX+unNvqkKaIyWTANAdSeG7U=;
b=1IwLpLRC9e+2hiBBZgOPS+4NyGwS19zCx0m3x1qfdhD4A1rauRxP7Oi4MNrL+2px4HES
YR4Ol38/29zkQjKOCqxX0+Ctz0N7DrSlEExfpDIQ0kZFt/Zxni/MUbGTGD07VU1RlAOy0
A3mxaWNCMziytw43crNPCnBYmvTrXvvmnjGjNXZ/95fUaIpz2ETLH+aRcNi2W+agZn8We
2TpwuC4ZlU1aoQau0s/pm+Gqh6B/cZDEMAUlVfdyPHucGN1SqXeXwO4FfvWvRRy+iaSHx
n/bGiaDZOcYAdS2dT9GBBqQHjS7Psk2+2+KmntYa2DJz1J00pDS1Ty/hqRMhmMrBRCA==
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=20260707 header.b="EqMe+/++";
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 DF0E1606A333;
Wed, 2 Dec 2026 21:53:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=EqMe+/++
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.161.50
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796248409;
b=FXfA6Hx4OhP+E7YFsJYgVOWMVP6oKWm+4YgplCJvVppu5hYgQKKPu0V1we8xzQEPigqf
1OjpmIFUpQbYZDxb790n7/soBjCzPpKIZSSYqt0wGLhN9gegn08hoVKZDWg9xkEZ78uAV
IPK/NW3ecKNlZri4jjPXXaru5+CqkTQDOVjjCC3ZFlOs9zXrwx1S1eRywfKmatXFpBTED
coEN0uoVBrjaGukIFuo4pFYMrE7XZajKm330XJFtzw9ketpFGMDcVxn2xnD5V05KNCQyo
Ubai4Ts4E6HqtfPLe4uCcYnIWau+I4xj4ywWPuWGy1RFjXGJNN3QnZe+Jkjv28Mkb6A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796248409;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:MIME-Version:References:
In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type;
bh=Qk+SGiEpWZ2D1VdTAtViX+unNvqkKaIyWTANAdSeG7U=;
b=h27KSakgvvYkFxaEml20CIbDFQ+w0E08gv1XpSUBFFajeHGy6gUCqW/8yZd/BHJAEjEa
45TRWLzNf8hHP9Rbo6urVD393VLSMk2lawyCiEGBDEETKGqksbBCy03biN8tkHQLlHNGG
mrSKAL2fIlZN5dLaj6N9K29BmkpMos5y07TeT3B6/mx2/NR+fJsUQQP0J659e4EvCm3As
bKB3Vca6PiVYQYlk1m+XCvIae1pvqtoBxUsZoYl/JMASXN5XsnqEd739RoAjhV3MB50XL
lHz3R3QT450LEm1BL+PmwreG37F9XeG3qMBJ7cVpBmJfMtWeXC4vwb3qkzAShV1/81w==
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=20260707 header.b="EqMe+/++";
arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.161.50
X-Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50])
(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 AB0F6606A322
for <git@vger.kernel.org>; Wed, 2 Dec 2026 21:53:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AB0F6606A322
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-oo1-f50.google.com with SMTP id 006d021491bc7-702dedeb70dso7838786eaf.1
for <git@vger.kernel.org>; Wed, 02 Dec 2026 13:53:28 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1796248407; cv=none;
d=google.com; s=arc-20260327;
b=R9/+CfDYsxi4L0IIsQbqjpRQWxC+3PNPf1+vvFlIVos/Ah6EnW091FvNSpuFxwivWZ
n7Y1B2lp9Ssf5tVhdUJ7vap0aS9YVgZzl3HTddpEGjJh6oL5G/HZKspJbGiP8ubFvP45
nwUqM+pmXpaF3s/0XN3t4fneJ9V2/RiaJUy4esafhNLrXtN/uBqy9D2kLsDP3aZrjnUy
QEsrjT8eES7+yPimcSIZRklFGFXjuuKnwXi1J0jRVFXYXyq4iOmJkp9XlW2yaX8gkjaD
k3iANie85wwfBQq682Ykkb70dkyoVrncemjVPC7Cq6usoIxrTbF8ZwlzSQSdreUxd9v4
k8aQ==
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:in-reply-to:references
:mime-version:dkim-signature;
bh=Qk+SGiEpWZ2D1VdTAtViX+unNvqkKaIyWTANAdSeG7U=;
fh=tJbo10YBDfXJfl6HsuXn4kwyWC0FAZokToz0LxBhLo4=;
b=HXFqt777a4YeJM9afkb5LfLsDdzydY/qP6P660t7H06p8mVcdizY55lwJ80F5ozkmb
IKwiIV5Xdsa5dM4BgTPpRvyCcQ5MhWwhN2PUTlYeSJSXMd7B6M2NuZPQSDfQ6Vrg31NX
z+EIxrGSaYwfBzzFMTo7i/RfEnde2e8XuR6M78B206SOpTgVl3HE+xcAoUhnBHPa/vqG
yKWFJn2nOp1YWbzaNupuf9br98s3hwQb9XKcLZLy1bWwt1+NRBtSdpMUDIZidbeMCTBs
+AhRJDpIEiVREYU5w7vat4WFkv7IXV8CnRRp5vJpl/cvJ3pdOlFsW3qMsxZw3sYUcZmh
gu+A==;
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=20260707; t=1796248407; x=1796853207; darn=vger.kernel.org;
h=content-type:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=Qk+SGiEpWZ2D1VdTAtViX+unNvqkKaIyWTANAdSeG7U=;
b=EqMe+/++7wJcBCiMJXzdM9Wq+wiKVIg9rHtOQOxzUmlsQU98n9itg0H60nLVwfPBOp
KzsOEXP9a+Ddje/TqgtvDqDL7r4rsgfE8N5nxYHomBaU0rncsBzW112uYmy6jlyBXl0k
Miu/yEY4t44n3b0Gi8dGQpCimM4xzQJAinlhVOSbQ40S2wITHXJ8qw5ZO9Ypo059qICg
OHD1Sr1mhByKLPJ4D6xaYTanglCt9bsv6q+D0hI1gmDwvKVwHRVL8JyIsByAtnJGUN89
9SA6jWIQkthNmjT6j6iB4HvSAN5GrQkqfGQWfD8fdKYceLySR0TtLRoUKe7Mu3gJ4gDV
hb3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796248407; x=1796853207;
h=content-type:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=Qk+SGiEpWZ2D1VdTAtViX+unNvqkKaIyWTANAdSeG7U=;
b=Y3C1xoOoRtDydp77GbA8zT6S+uikx2vC4pXvzwVrZ+AgBMN2/3vXAgz1+Ekb+EsbWK
GMxJkjZulw7gpCbnQkYPFweVdQlyGL7hUCLAUgedXHVd1VM5U3rAex++Jwtoj3dpxUSn
sp13vormz3hMO4HxbagNBmcdBTHvEOOEyuSDv1L585upgOXcegZqdhZemWp6DQ+RUslc
dpWRV63JX2Bi7U2mj8ECQjfRwdPdTLTojuHu/IIYLyRTZH13eRUfw7JMGE+7PpeuqJsr
YbJYVhYcEW70TetGegwkrIOdMMO8BwBPC37inHIK0dfo7Cg4NATZ6r35nvYOBvGJSliZ
Dt2g==
X-Gm-Message-State: APuU4Z9w00kSs17UuK/wI0Fn2k6+mpNiN1ucfyJFWm5T2LWwmhy103yJ
UiCA5mzkvRDkjYUVxKt0V96Aoxp4gbq17DDDEbB27dBHSpSukDnBw6zv8I7KuE+JnWVC39knlEL
nR82CCkVyJkm592d2YZchSk3hNDGb2+A=
X-Gm-Gg: AZFdTZdYDaIKdOinlU25kuVw1SP0Pa7zMU3nQ6PLjLAdXmyTChe2Rg9RggMdDcyZF7w
t35fAYov9d7NMxkX6UClJFgqKVsM3vFVmta7UeFseAoyccIF3JMDVcb6jVj+U5ld2IwKyPlgnXD
k/af6kbcQhn31RefGaxWLD9GvZbWtOkSIoGFNfkM3jfMkiWl1ySxil1Jut/xtWDnbBXuq2sMeWO
5KgAGZZ7CgMbBC/9RH1WdlP0zRqEhBtQYllaFE083kdCq7OFOUjcbVi5iADodKiUEuIRBv4jyOr
J2XQqK8uTUprl3KdqseOXkBS4SaWhuwLt7ShFiJEQUBEyRvvBYpHIMi11sNVwWpsnwo1Nqcgi/e
8gGv+49LHTdTAk6qov7SEQa5hR1CtaIzWwO+w+Zr7SbNAEI/iI1/X0b96sTcdvvXySnAlXr4u7O
LA/VJ33em5JsolsbpQB1FN6JEp/qbR5wRQul1tX+qxL2VByG5nc4Rnrg==
X-Received: by 2002:a05:6820:151a:b0:71b:8238:4e40 with SMTP id
006d021491bc7-71b8238545emr21055757eaf.4.1796248407569; Wed, 02 Dec 2026
13:53:27 -0800 (PST)
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-In-Reply-To: <CAAQS9U+76TGukWp+AMWN9CY_tU9kD_3Wzq9k7PzLnUqAd8SuhQ@mail.gmail.com>
X-Gm-Features: Aa3M54o68rviXK53C_LLTpEyg2UGuirBjD7wuOKZCtZwZch3okqwg8IdOMo4qWM
X-Cc: git@vger.kernel.org, quark.zju@gmail.com