Skip to content
Snippets Groups Projects

gitserver: mark repository as corrupted if commit-graph is malformed

Merged Warren Gifford requested to merge gitserver-fatal-commit-graph into main

Created by: ggilmore

Fixes https://github.com/sourcegraph/sourcegraph/issues/37872

On dogfood, git operations against the megarepo are currently failing with error messages that look like the following:

...
fatal: commit-graph requires overflow generation data but has none
error: <repo> did not send all necessary objects
...

It looks like this was a bug that was introduced in git 2.36.1: https://lore.kernel.org/git/581c7ef2-3de4-eb8a-bfbb-d4bca3522a2d@github.com/T/. This bug is unresolved as of this time of writing.

We upgraded to git 2.36.1 in all of our docker images in https://github.com/sourcegraph/sourcegraph/commit/04c98ab493e0889394e2e60fb85e1a53225e5a35.


This PR works around this issue by having gitserver mark a repository as corrupted if the fatal: commit-graph requires overflow generation data but has none message occurs in the standard error output.

The mailing list threads suggest that a cheaper solution is just to rm objects/info/commit-graph && git gc (which avoids a re-clone). However, I think it's easier operationally if we are consistent with just re-cloning whenever we encounter these (hopefully infrequent) kinds of corruption errors.

Test plan

Unit tests.

We'll also see in dogfood's logs if the error is resolved once this image is deployed.

Merge request reports

Approval is optional

Merged by avatar (Jul 13, 2025 12:46am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading