{"thread":{"id":"56473","subject":"[BUG REPORT] Intermittent errors: Unable to create '/usr/ports/.git/index.lock': File exists.","startedAt":"2021-09-09T19:30:36Z","lastAt":"2021-09-09T20:19:18Z","messageCount":2,"participants":["Yuri","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"435316","messageId":"1fcdeb8f-5869-cfe4-6063-8d4fb5da709c@rawbw.com","threadId":"56473","inReplyTo":null,"subject":"[BUG REPORT] Intermittent errors: Unable to create '/usr/ports/.git/index.lock': File exists.","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2021-09-09T19:29:32Z","receivedAt":"2021-09-09T19:30:36Z","isPatch":false,"sender":{"key":"yuri@rawbw.com","avatar":null},"body":"Once every ~20 times I call 'git commit' it fails like this:\n\n$ git commit .\nfatal: Unable to create '/usr/ports/.git/index.lock': File exists.\n\nAnother git process seems to be running in this repository, e.g.\nan editor opened by 'git commit'. Please make sure all processes\nare terminated then try again. If it still fails, a git process\nmay have crashed in this repository earlier:\nremove the file manually to continue.\n\n\nThere's no other instance.\n\nIt usually succeeds next time.\n\n\ngit-2.32.0\n\nOS: FreeBSD 13\n\n\nYuri\n\n"},{"id":"435330","messageId":"YTpsQtJa2rX691c0@coredump.intra.peff.net","threadId":"56473","inReplyTo":"1fcdeb8f-5869-cfe4-6063-8d4fb5da709c@rawbw.com","subject":"Re: [BUG REPORT] Intermittent errors: Unable to create '/usr/ports/.git/index.lock': File exists.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-09-09T20:19:14Z","receivedAt":"2021-09-09T20:19:18Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 09, 2021 at 12:29:32PM -0700, Yuri wrote:\n\n> Once every ~20 times I call 'git commit' it fails like this:\n> \n> $ git commit .\n> fatal: Unable to create '/usr/ports/.git/index.lock': File exists.\n> \n> Another git process seems to be running in this repository, e.g.\n> an editor opened by 'git commit'. Please make sure all processes\n> are terminated then try again. If it still fails, a git process\n> may have crashed in this repository earlier:\n> remove the file manually to continue.\n> \n> \n> There's no other instance.\n\nIn previous cases of this we've seen, there usually _is_ another\ninstance, just not one directly triggered by the user. E.g., some GUI\nclients will trigger \"git status\" in the background, which tries to\nrefresh the index.\n\nIf you're running any other Git-related tools (or anything via cron),\nthose might be worth investigating. Otherwise you might try using OS\ntools to see which processes might be opening such a file (on Linux I'd\nuse inotifywait, but I'm not sure what's available on FreeBSD).\n\nIf you do find the culprit, one solution is to get it to use the\n\"--no-optional-locks\" option. See the discussion of that option and\nGIT_OPTIONAL_LOCKS in git(1), as well as the \"BACKGROUND REFRESH\"\nsection of git-status(1).\n\n-Peff\n"}]}