git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: `git fetch origin --prune --atomic` core dumped

From
Justin Tobler <jltobler@gmail.com>
Date
Mar 20, 2025, 16:10 UTC
Message-ID
<g4baz2kt25ysb6wcesoqxhvw2ooxkmqio3dj6b44h6gt5l6z3r@rocsjlys5nqs>
In-Reply-To
<e8789a03-41ea-42e2-9f2d-5124b849277a.likui@oschina.cn>
On 25/03/20 04:36PM, 李葵 wrote:
Show 77 quoted lines
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
>   ```bash
>   git clone --quiet --mirror https://github.com/git/git-merge.git git-merge.git.git
>   git clone --quiet --mirror git-merge.git.git git-merge.git
> 
>   git --git-dir=git-merge.git.git branch test main
> 
>   touch git-merge.git/refs/heads/test.lock
>   git --git-dir=git-merge.git fetch origin --prune --atomic "+refs/*:refs/*"
>   ```
> 
> What did you expect to happen? (Expected behavior)
> 
>   Without core dumped.
> 
> What happened instead? (Actual behavior)
> 
>   ```bash
>   $ git clone --quiet --mirror https://github.com/git/git-merge.git git-merge.git.git
> 
>   $ git clone --quiet --mirror git-merge.git.git git-merge.git
> 
>   $ git --git-dir=git-merge.git.git branch test main
>   branch 'test' set up to track 'origin/main'.
> 
>   $ touch git-merge.git/refs/heads/test.lock
> 
>   $ git --git-dir=git-merge.git fetch origin --prune --atomic "+refs/*:refs/*"
>   From /tmp/git/git-merge.git
>    * [new branch]      test       -> test
>   error: cannot lock ref 'refs/heads/test': Unable to create '/tmp/git/git-merge.git/refs/heads/test.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.
>   BUG: refs.c:2435: abort called on a closed reference transaction
>   [1]    1298748 IOT instruction (core dumped)  git --git-dir=git-merge.git fetch origin --prune --atomic "+refs/*:refs/*"
> 
>   $ ls
>   core.1298748  git-merge.git  git-merge.git.git
>   ```
> 
> What's different between what you expected and what actually happened?
> 
>   Without core dumped.
> 
> Anything else you want to add:
> 
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
> 
> 
> [System Info]
> git version:
> git version 2.49.0.rc1.120.g683c54c999
> cpu: x86_64
> built from commit: 683c54c999c301c2cd6f715c411407c413b1d84e
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> libcurl: 7.81.0
> OpenSSL: OpenSSL 3.0.2 15 Mar 2022
> zlib: 1.2.11
> uname: Linux 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 x86_64
> compiler info: gnuc: 11.4
> libc info: glibc: 2.35
> $SHELL (typically, interactive shell): /usr/bin/zsh
> 
> 
> [Enabled Hooks]
> not run from a git repository - no hooks to show
I was able to reproduce the reported bug with the following:
    git init foo &&
    git -C foo commit --allow-empty -m init &&
    git clone --mirror foo bar.git &&
    git -C bar.git branch test master &&
    touch bar.git/refs/heads/test.lock &&
    git -C bar.git fetch origin --prune --atomic "+refs/*:refs/*"

This bisects to c92abe71df (builtin/fetch: fix leaking transaction with `--atomic`, 2024-08-22). cc'ing the author.

-Justin
Previous: 李葵Next: Justin Tobler
Message 2 of 6 in “`git fetch origin --prune --atomic` core dumped”
  1. 李葵Mar 20, 2025
  2. Justin ToblerMar 20, 2025
  3. builtin/fetch: avoid aborting closed reference transactionJustin Tobler, Mar 21, 2025
  4. Patrick SteinhardtMar 24, 2025
  5. Justin ToblerMar 24, 2025
  6. Patrick SteinhardtMar 24, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.