Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commit-graph: writing missing parents is a BUG #102

Closed

Conversation

derrickstolee
Copy link

A user complained that they had the following message in a git command:

fatal: invalid parent position 2147483647

In hex, this value is 0x7fffffff, corresponding to the GRAPH_MISSING_PARENT constant. This constant was intended as a way to have the commit-graph store commits with parents that are not also in the commit-graph. During development, however, we chose to require the commit-graph to be closed under reachability. Thus, this value should never be written, and we don't fall back to parsing usual commits when we see the constant.

This actually happened, and the root cause is unknown. This either means the reachable closure logic is broken somewhere, or something caused the binary search to find the parent in our list of commits. This second problem is more likely, as we have seen RAM issues cause corrupted memory before. I'm still investigating the root cause, but for now we can hit a BUG() statement instead of writing bad data.

Thanks,
-Stolee

When writing a commit-graph, we write GRAPH_MISSING_PARENT if the
parent's object id does not appear in the list of commits to be
written into the commit-graph. This was done as the initial design
allowed commits to have missing parents, but the final version
requires the commit-graph to be closed under reachability. Thus,
this GRAPH_MISSING_PARENT value should never be written.

However, there are reasons why it could be written! These range
from a bug in the reachable-closure code to a memory error causing
the binary search into the list of object ids to fail. In either
case, we should fail fast and avoid writing the commit-graph file
with bad data.

Remove the GRAPH_MISSING_PARENT constant in favor of the constant
GRAPH_EDGE_LAST_MASK, which has the same value.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
@derrickstolee
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Dec 19, 2018

Submitted as pull.102.git.gitgitgadget@gmail.com

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 3, 2019

This branch is now known as ds/commit-graph-assert-missing-parents.

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 3, 2019

This patch series was integrated into pu via git@6df4bba.

@gitgitgadget gitgitgadget bot added the pu label Jan 3, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Jan 3, 2019

This patch series was integrated into pu via git@e1db812.

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 4, 2019

This patch series was integrated into pu via git@13930be.

@gitgitgadget
Copy link

gitgitgadget bot commented Jan 7, 2019

This patch series was integrated into pu via git@46fb1f8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant