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

Git clone fails GitError: (no message provided) #494

Closed
milosgajdos opened this issue Feb 18, 2015 · 16 comments
Closed

Git clone fails GitError: (no message provided) #494

milosgajdos opened this issue Feb 18, 2015 · 16 comments

Comments

@milosgajdos
Copy link

We are using pygit in some of our internal tools. We noticed some weird behaviour we can not explain when cloning one of our repos. Here is a traceback:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    r = pygit2.clone_repository('https://github.com/ministryofjustice/sensu-formula.git', '/tmp/sensu-formula')
  File "/Users/milosgajdos/projects/saltshaker/lib/python2.7/site-packages/pygit2/__init__.py", line 265, in clone_repository
    check_error(err)
  File "/Users/milosgajdos/projects/saltshaker/lib/python2.7/site-packages/pygit2/errors.py", line 56, in check_error
    raise GitError(message)
_pygit2.GitError: (no message provided)

Here's a code sample to reproduce the error above:

import pygit2
r = pygit2.clone_repository('https://github.com/ministryofjustice/sensu-formula.git', '/tmp/sensu-formula')

pygit version:
pygit2==0.22.0

libgit2 version:
libgit2: stable 0.22.0 (bottled), HEAD

Interestingly enough when using the exact same script, but for a different repo, all goes just fine, which makes me totally confused about the cause of this issue.

jdavid added a commit that referenced this issue Feb 20, 2015
@jdavid
Copy link
Member

jdavid commented Feb 20, 2015

Cannot reproduce the problem with libgit2 0.22.1 and pygit2 0.22.0

Latest pygit2 commit should show the Git error code in the Python's error message, could you try with it?

@milosgajdos
Copy link
Author

I have tested this with 0.22.1 like you suggested and it seems to have resolved the issue.

Thanks for the hint.

@ashb
Copy link
Contributor

ashb commented Feb 20, 2015

Is there any way from in python code/pygit2 to check what version of libgit2 is in use?

@mattmb
Copy link

mattmb commented Mar 10, 2015

Afraid I'm still having a problem...

To reproduce. Edit the brew formula to install libgit2 0.22.1.

brew install libgit2 --with-libssh2
mkvirtualenv blah
pip install -e git+http://github.com/libgit2/pygit2@master#egg=pygit2
python

Then

Python 2.7.9 (default, Feb 10 2015, 03:28:08) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygit2
>>> pygit2.clone_repository('https://github.com/ministryofjustice/sensu-formula.git', '/tmp/sensu-formula')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/matt/.virtualenvs/blah/src/pygit2/pygit2/__init__.py", line 286, in clone_repository
    check_error(err)
  File "/Users/matt/.virtualenvs/blah/src/pygit2/pygit2/errors.py", line 64, in check_error
    raise GitError(message)
_pygit2.GitError: err -1 (no message provided)
>>> 

Any ideas?

@mattmb
Copy link

mattmb commented Mar 10, 2015

Interestingly this seems to be a repo specific problem! It works with other repos, just not with https://github.com/ministryofjustice/sensu-formula.git

@carlosmn
Copy link
Member

That repository either doesn't exist or is private, and you're not providing any credentials to give to GitHub, though I would have expected there to be an error message set.

@mattmb
Copy link

mattmb commented Mar 10, 2015

@carlosmn It's public, try a git clone 😄

@carlosmn
Copy link
Member

Sorry, my MUA used the end quote as part of the url to open, the repo is indeed there and public. The error seems to be in the delta resolution process, though for me it can also cause what looks like an infinite loop.

@mattmb
Copy link

mattmb commented Mar 13, 2015

Thanks for taking a look at this @carlosmn. Would you say it's an issue in libgit2 rather than pygit2 specifically?

@carlosmn
Copy link
Member

Yes, it'd be a bug in the library, but it's hard to know where if it doesn't set an error message. There was a recent change to GitHub's server which means libgit2 will now often fail. You can apply libgit2/libgit2@a34692c419 which will confirm if it's the issue with the new packs which GitHub is sending.

@farvour
Copy link

farvour commented Mar 13, 2015

Is there a particular workaround for this that does not involve upgrading libgit2? The version of libgit2 that comes with Ubuntu 14.04LTS is still 0.19.0. Short of building a custom package through fpm, is there a better way to approach this issue?

The commit you reference above doesn't seem to actually "fix" the problem. It just simply returns a different error message.

@carlosmn
Copy link
Member

The commit you reference above doesn't seem to actually "fix" the problem. It just simply returns a different error message.

It returns an error message, which would be useful in determining if is that error or a different one. The error message is the right behaviour here, the GitHub server is currently serving bad packfiles. The actual fix is to wait for GitHub to fix it, as it's on their side.

You may be able to work around the bug if you turn off tag auto-following when cloning, though I'm not sure if pygit2 exposes this.

@farvour
Copy link

farvour commented Mar 13, 2015

Okay. Thanks for the explaination @carlosmn . I guess we will have to sit and wait for Github to fix the issue.

Do you think it would be wise to open a ticket to them regarding this issue on affected private repositories we're having trouble with? I can't imagine this is small potatoes to them at this point. A lot of people depend on libgit2, no?

@carlosmn
Copy link
Member

This is already fixed.

@mattmb
Copy link

mattmb commented Mar 16, 2015

@carlosmn that's good news, thanks for your help! Out of interest did you talk to GitHub to find out about the bad pack files?

cc @kyriakosoikonomakos

@carlosmn
Copy link
Member

We traced the error to one of the cache insertions, as the hashtable library returned an error, which we then confirmed to be because of duplicate objects. As GitHub had introduced a change in their handling of include-tag, we contacted them to figure out which side was behaving badly.

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

No branches or pull requests

6 participants