Skip to content

Human action 337

Jerry Holland edited this page Oct 26, 2026 · 1 revision

Report Git's commit-graph hang on an overflowing committer date upstream

Procedure for issue #337. The issue is the record of ownership, status, and completion evidence; this page is the execution instruction.

Owner role: the repository owner, or anyone willing to post to the Git mailing list under their own name. An agent does not send outward posts.

Why: causet's generated-history corpus (#308, PR #333) generated a commit whose committer date overflows, 99999999999999999999. On Git 2.56.0, git gc then spun at 100% CPU for 8.5 hours, until it was killed, in write_commit_graph → compute_reachable_generation_numbers. Git reads such commits (git fsck reports badDateOverflow, but every command still reads them), so a repository holding one can hang every git gc or git maintenance run. causet now avoids generating that date on a committer line and stops any process after 5 minutes, so nothing in causet waits on this. Reporting it helps Git, which is still causet's substrate.

Prerequisites

  • A POSIX shell with git, mktemp and timeout (Linux, or Git Bash on Windows), and the newest Git release you can install. Check with git --version.
  • A mail client that can send plain-text mail (no HTML). The Git list rejects HTML mail. git send-email works too, but isn't needed for a bug report.
  • No subscription is needed to post to git@vger.kernel.org.

Steps

  1. Check for an existing report. Search the list archive for commit-graph generation overflow and compute_reachable_generation_numbers at https://lore.kernel.org/git/. If a report or a fix already covers this, link it on #337 and skip to Completion.

  2. Run the reproduction on the newest Git you have. Save this as git-hang-repro.sh in any directory and run sh git-hang-repro.sh. It works in a temporary directory and removes it.

    #!/bin/sh
    # git commit-graph write loops forever on a committer date that overflows
    set -e
    dir=$(mktemp -d)
    git init -q --bare "$dir/repo.git"
    cd "$dir/repo.git"
    tree=$(git hash-object -t tree -w --stdin </dev/null)
    commit() {
      # $1 = parent line or empty, $2 = committer date
      printf 'tree %s\n%sauthor A <a@example.com> 1700000000 +0000\ncommitter C <c@example.com> %s +0000\n\nm\n' \
        "$tree" "$1" "$2" | git hash-object -t commit -w --literally --stdin
    }
    c1=$(commit "" 99999999999999999999)
    c2=$(commit "parent $c1
    " 1700000001)
    c3=$(commit "parent $c2
    " 1700000002)
    git update-ref refs/heads/main "$c3"
    git --version
    if timeout 20 git commit-graph write --reachable; then
      echo "commit-graph write finished"
    else
      echo "commit-graph write did not finish in 20 s (exit $?)"
    fi
    rm -rf "$dir"

    Expected on an affected Git:

    git version 2.56.0
    commit-graph write did not finish in 20 s (exit 124)
    

    If it prints commit-graph write finished, the bug is fixed in that version: record the version on #337 and skip to Completion.

  3. Send the report. Send a plain-text mail to git@vger.kernel.org. Replace <VERSION> with the version from step 2 and <OS> with your system:

    Subject: commit-graph write never ends on a commit whose committer date overflows
    
    Hi,
    
    `git commit-graph write --reachable`, and so `git gc`, loops forever when a
    commit's committer date overflows timestamp_t and the commit has at least
    two generations of descendants. It reproduces on git <VERSION> (<OS>):
    
    <paste the script from step 2>
    
    The script's output:
    
    <paste the output of step 2>
    
    A stack sampled three times during a hung `git gc` (2.56.0) was the same each time:
    
      commit_graph_data_at
      get_generation_from_graph_data
      compute_reachable_generation_numbers
      write_commit_graph
      write_commit_graph_reachable
      cmd_gc
    
    With only one descendant there is no hang, and neither a date of 2^63 nor an
    overflowing author date causes one. I'd guess the corrected commit date
    computed from the saturated date wraps, so a generation never leaves
    GENERATION_NUMBER_ZERO and the commit is pushed again forever, but I haven't
    confirmed that.
    
    `git fsck` reports the commit as badDateOverflow, but such a commit can
    arrive by fetch from a repository that doesn't check, and then every gc or
    maintenance run hangs.
    
    We found this with generated test histories in causet
    (https://github.com/jwh3times/causet/issues/337).
    
    Thanks,
    <your name>
    

Verification

  • Pass: within about an hour, the mail appears in https://lore.kernel.org/git/ (search for the subject). Record its archive link on #337.
  • Not yet: if it hasn't appeared after a day, check that it was sent as plain text and that your mail server didn't reject it, then send it again.

Failure handling

  • If the list rejects the mail, the bounce names the reason. HTML parts and attachments are the usual ones. Fix it and send again.
  • If a reply asks for more detail, the copy in causet's checkout is test-support/generated-histories.js (ident); the corpus history that found it was index 13 modulo 16 of seed causet-n1 before the change. The reproduction above is self-contained.
  • Nothing is created outside the script's temporary directory, so there is nothing to clean up.

Completion

On #337, record:

  • the reproduction's output and Git version;
  • the archive link to the report, or to the existing report or fix that covers it;
  • any reply that changes what causet should do, for example the Git version that fixes it, after which the corpus could draw the date for committers again.

Then remove human-action-required, close #337, set its board Status to Done, and mark this page's row on Human TODO Done with the link.

Clone this wiki locally