git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ISSUE - Sequential execution failure - Lock auto created between git commands
@ 2025-05-25 14:13 Yonatan Roth
  2025-05-26 13:23 ` Patrick Steinhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Yonatan Roth @ 2025-05-25 14:13 UTC (permalink / raw)
  To: git


[-- Attachment #1.1: Type: text/plain, Size: 1547 bytes --]

Hi,


Using a script we run the following set of git commands:

git branch -a

git remote -v

git stash push --all --include-untracked

git checkout test_git_ver

git remote -v

git fetch

git status --branch --porcelain=v1 -u

git checkout test_git_ver_workspace




After upgrading the git version to - *2.47.2*, we started getting the
following error:

error: cannot lock ref 'HEAD': Unable to create '.../.git/*HEAD.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.

fatal: unable to update HEAD




Investigating the issue on our side, we found that the failure occurs when
running the last command -
git checkout test_git_ver_workspace.

As well, we noticed that after the "git fetch" command there is an *auto *
*maintenance* execution, it looks like there was a change between git
versions and now there is an additional flag *--detach *added to
maintenance.
Therefore, we suspect that as a result of git fetch a maintenance detached
(background) process is created, running in parallel to the general script,
creating a lock file that fails the script.


Attached trace logs.


This script was running for multiple versions without any issue, it looks
like the changes introduce a *regression*.

Please assist in resolving the issue.




Best regards,
Yonatan Roth
Palo Alto Networks

[-- Attachment #1.2: Type: text/html, Size: 9439 bytes --]

[-- Attachment #2: trace.txt --]
[-- Type: text/plain, Size: 863 bytes --]

Trace logs:


12:54:52.400869 run-command.c:666       trace: run_command: git rev-list --objects --stdin --not --exclude-hidden=fetch --all --quiet --alternate-refs

12:54:52.400936 run-command.c:758       trace: start_command: /usr/local/libexec/git-core/git rev-list --objects --stdin --not --exclude-hidden=fetch --all --quiet --alternate-refs

12:54:52.483329 run-command.c:1534      run_processes_parallel: preparing to run up to 1 tasks

12:54:52.483384 run-command.c:1561      run_processes_parallel: done

12:54:52.483395 run-command.c:666       trace: run_command: git maintenance run --auto --no-quiet --detach

12:54:52.483475 run-command.c:758       trace: start_command: /usr/local/libexec/git-core/git maintenance run --auto --no-quiet --detach

12:54:52.494826 git.c:479               trace: built-in: git maintenance run --auto --no-quiet --detach

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ISSUE - Sequential execution failure - Lock auto created between git commands
  2025-05-25 14:13 ISSUE - Sequential execution failure - Lock auto created between git commands Yonatan Roth
@ 2025-05-26 13:23 ` Patrick Steinhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick Steinhardt @ 2025-05-26 13:23 UTC (permalink / raw)
  To: Yonatan Roth; +Cc: git

On Sun, May 25, 2025 at 05:13:30PM +0300, Yonatan Roth wrote:
> Hi,
> 
> 
> Using a script we run the following set of git commands:
> 
> git branch -a
> 
> git remote -v
> 
> git stash push --all --include-untracked
> 
> git checkout test_git_ver
> 
> git remote -v
> 
> git fetch
> 
> git status --branch --porcelain=v1 -u
> 
> git checkout test_git_ver_workspace
> 
> 
> 
> 
> After upgrading the git version to - *2.47.2*, we started getting the
> following error:
> 
> error: cannot lock ref 'HEAD': Unable to create '.../.git/*HEAD.lock*':
> File exists.

This sounds similar to the issue reported in [1], please see my reply
there. I'll send a patch series the over the next days to address the
issue.

Patrick

[1]: <CANi7bVAkNc+gY1NoXfJuDRjxjZLTgL8Lfn8_ZmWsvLAoiLPkNg@mail.gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-26 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-25 14:13 ISSUE - Sequential execution failure - Lock auto created between git commands Yonatan Roth
2025-05-26 13:23 ` Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).