From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 60EE21F8C6 for ; Thu, 9 Sep 2021 20:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237355AbhIIUU0 (ORCPT ); Thu, 9 Sep 2021 16:20:26 -0400 Received: from cloud.peff.net ([104.130.231.41]:43320 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233471AbhIIUUZ (ORCPT ); Thu, 9 Sep 2021 16:20:25 -0400 Received: (qmail 800 invoked by uid 109); 9 Sep 2021 20:19:15 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Thu, 09 Sep 2021 20:19:15 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 16453 invoked by uid 111); 9 Sep 2021 20:19:16 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Thu, 09 Sep 2021 16:19:16 -0400 Authentication-Results: peff.net; auth=none Date: Thu, 9 Sep 2021 16:19:14 -0400 From: Jeff King To: Yuri Cc: Git Mailing List Subject: Re: [BUG REPORT] Intermittent errors: Unable to create '/usr/ports/.git/index.lock': File exists. Message-ID: References: <1fcdeb8f-5869-cfe4-6063-8d4fb5da709c@rawbw.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1fcdeb8f-5869-cfe4-6063-8d4fb5da709c@rawbw.com> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Thu, Sep 09, 2021 at 12:29:32PM -0700, Yuri wrote: > Once every ~20 times I call 'git commit' it fails like this: > > $ git commit . > fatal: Unable to create '/usr/ports/.git/index.lock': File exists. > > Another git process seems to be running in this repository, e.g. > an editor opened by 'git commit'. Please make sure all processes > are terminated then try again. If it still fails, a git process > may have crashed in this repository earlier: > remove the file manually to continue. > > > There's no other instance. In previous cases of this we've seen, there usually _is_ another instance, just not one directly triggered by the user. E.g., some GUI clients will trigger "git status" in the background, which tries to refresh the index. If you're running any other Git-related tools (or anything via cron), those might be worth investigating. Otherwise you might try using OS tools to see which processes might be opening such a file (on Linux I'd use inotifywait, but I'm not sure what's available on FreeBSD). If you do find the culprit, one solution is to get it to use the "--no-optional-locks" option. See the discussion of that option and GIT_OPTIONAL_LOCKS in git(1), as well as the "BACKGROUND REFRESH" section of git-status(1). -Peff