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

send-pack: do not check for sha1 file when GVFS_MISSING_OK set #68

Merged
merged 1 commit into from
Nov 27, 2018

Conversation

kewillford
Copy link
Member

This is to fix the issue on Mac where the push will hang because the read-object hook process gets spawned and the pack-object process has also been spawned and something, maybe stdin/stdout, get in a deadlock. Still need to find the smoking gun.

For this fix, it will check the GVFS flag before checking that an object doesn't exist so that it will not download the object. @derrickstolee I'm not sure how this will affect push performance since it will be sending more negative oids to the pack-object process. Still need to dig into the pack-object code to see determine if this is the right change.

Copy link
Collaborator

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a safe change.

@@ -50,7 +51,7 @@ static int send_pack_config(const char *var, const char *value, void *unused)

static void feed_object(const struct object_id *oid, FILE *fh, int negative)
{
if (negative && !has_sha1_file(oid->hash))
if (negative && !gvfs_config_is_set(GVFS_MISSING_OK) && !has_sha1_file(oid->hash))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kewillford We should be a bit careful here. Specifically, git push starts with an info/refs call to find the current branch tips. If those tips have moved ahead of our prefetch packfiles, then those commits will require the read-object hook. This logic will prevent those commits from being sent to send-pack and hence will not be considered as --not commits in the revision walk. This can lead to over-pushing objects.

In a particularly egregious case, think about a fresh clone with master as the only branch favorite. I clone, make a simple change, and push. The master branch has moved ahead, but now we tell pack-objects to pack our commit and sends zero --not commits. We will pack the entire repo and try to push it.

Let me know if I'm misunderstanding the effect of this change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more likely that I am missing something, as if master moves ahead in a vanilla git repo, we don't have the object, so we continue without marking that as a --not commit. Instead, we probably use our refs/remote/origin/... refs. I'm going to do some digging and come back to this soon.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked with @kewillford offline and we determined that I was wrong, for multiple reasons. I was misreading some things and it took a while to shake them all out. Here is my new understanding of what's going on:

  1. git push calls git remote-https which calls git send-pack.
  2. Before, git send-pack would trigger the read-object hook and somehow this was causing timing issues.
  3. The change here is to remove the read-object calls from the send-pack logic by understanding we are in a virtualized environment and has_sha1_file(hash) will always return true.
  4. This change does not alter the set of --not commits passed to git pack-objects.
  5. The read-object hook will still be run by git pack-objects, but somehow this timing change prevents the failure.

Copy link
Collaborator

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, after I read it properly and understand everything. Thanks!

@@ -50,7 +51,7 @@ static int send_pack_config(const char *var, const char *value, void *unused)

static void feed_object(const struct object_id *oid, FILE *fh, int negative)
{
if (negative && !has_sha1_file(oid->hash))
if (negative && !gvfs_config_is_set(GVFS_MISSING_OK) && !has_sha1_file(oid->hash))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked with @kewillford offline and we determined that I was wrong, for multiple reasons. I was misreading some things and it took a while to shake them all out. Here is my new understanding of what's going on:

  1. git push calls git remote-https which calls git send-pack.
  2. Before, git send-pack would trigger the read-object hook and somehow this was causing timing issues.
  3. The change here is to remove the read-object calls from the send-pack logic by understanding we are in a virtualized environment and has_sha1_file(hash) will always return true.
  4. This change does not alter the set of --not commits passed to git pack-objects.
  5. The read-object hook will still be run by git pack-objects, but somehow this timing change prevents the failure.

@kewillford kewillford merged commit 43ac102 into microsoft:gvfs-2.19.1 Nov 27, 2018
dscho pushed a commit that referenced this pull request Dec 2, 2018
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request Dec 10, 2018
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
derrickstolee pushed a commit that referenced this pull request Dec 17, 2018
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request Feb 27, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request Mar 29, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request May 25, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request May 25, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request Jun 3, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request Jun 8, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request Aug 17, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
derrickstolee pushed a commit that referenced this pull request Oct 23, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
derrickstolee pushed a commit that referenced this pull request Nov 4, 2019
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
derrickstolee pushed a commit that referenced this pull request Jan 14, 2020
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
derrickstolee pushed a commit that referenced this pull request Feb 21, 2020
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
derrickstolee pushed a commit that referenced this pull request Mar 17, 2020
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
derrickstolee pushed a commit that referenced this pull request Mar 23, 2020
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request May 20, 2020
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
dscho pushed a commit that referenced this pull request May 20, 2020
…_MISSING_OK set

send-pack: do not check for sha1 file when GVFS_MISSING_OK set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants