Skip to content

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

Administrator 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/[email protected]/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

Loading