Dulwich error when pushing Git branch

Issue #471 resolved
Justin Holewinski created an issue

When pushing a specific Git branch to a Rhodecode server, I am encountering what appears to be an issue with Dulwich:

{{{ 2012-06-03 13:37:11.933 ERROR [waitress] Exception when serving /rhodecode/llvm/git-receive-pack Traceback (most recent call last): File "/home/rhodecode/venv/lib/python2.6/site-packages/waitress/channel.py", line 329, in service task.service() File "/home/rhodecode/venv/lib/python2.6/site-packages/waitress/task.py", line 173, in service self.execute() File "/home/rhodecode/venv/lib/python2.6/site-packages/waitress/task.py", line 380, in execute app_iter = self.channel.server.application(env, start_response) File "/home/rhodecode/venv/lib/python2.6/site-packages/PasteDeploy-1.5.0-py2.6.egg/paste/deploy/config.py", line 291, in call return self.app(environ, start_response) File "/home/rhodecode/venv/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/gzipper.py", line 38, in call response.gzip_start_response) File "/home/rhodecode/venv/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/cascade.py", line 130, in call return self.apps-1 File "/home/rhodecode/venv/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/registry.py", line 379, in call app_iter = self.application(environ, start_response) File "/home/rhodecode/venv/lib/python2.6/site-packages/rhodecode/lib/middleware/https_fixup.py", line 37, in call return self.application(environ, start_response) File "/home/rhodecode/venv/lib/python2.6/site-packages/Pylons-1.0-py2.6.egg/pylons/middleware.py", line 150, in call self.app, environ, catch_exc_info=True) File "/home/rhodecode/venv/lib/python2.6/site-packages/Pylons-1.0-py2.6.egg/pylons/util.py", line 51, in call_wsgi_application output.extend(app_iter) File "/home/rhodecode/venv/lib/python2.6/site-packages/dulwich-0.8.5-py2.6-linux-x86_64.egg/dulwich/web.py", line 231, in handle_service_request handler.handle() File "/home/rhodecode/venv/lib/python2.6/site-packages/dulwich-0.8.5-py2.6-linux-x86_64.egg/dulwich/server.py", line 710, in handle status = self._apply_pack(client_refs) File "/home/rhodecode/venv/lib/python2.6/site-packages/dulwich-0.8.5-py2.6-linux-x86_64.egg/dulwich/server.py", line 622, in _apply_pack self.proto.recv) File "/home/rhodecode/venv/lib/python2.6/site-packages/dulwich-0.8.5-py2.6-linux-x86_64.egg/dulwich/object_store.py", line 536, in add_thin_pack return self._complete_thin_pack(f, path, copier, indexer) File "/home/rhodecode/venv/lib/python2.6/site-packages/dulwich-0.8.5-py2.6-linux-x86_64.egg/dulwich/object_store.py", line 468, in _complete_thin_pack entries = list(indexer) File "/home/rhodecode/venv/lib/python2.6/site-packages/dulwich-0.8.5-py2.6-linux-x86_64.egg/dulwich/pack.py", line 1238, in _walk_all_chains for result in self._walk_ref_chains(): File "/home/rhodecode/venv/lib/python2.6/site-packages/dulwich-0.8.5-py2.6-linux-x86_64.egg/dulwich/pack.py", line 1260, in _walk_ref_chains self._pending_ref.pop(base_sha) KeyError: 'P\xf3\xdb\x8b\'\xfd\xaa\xbf\xab\xee\xc0s\x8eu5\x02\x04"\xe5\x07' }}}

I haven't been able to identify a small repo procedure, but I get this error when I try to create a local clone of LLVM:

{{{ <create repo on Rhodecode server> $ git clone http://llvm.org/git/llvm.git $ cd llvm $ git push https://user@server/rhodecode/llvm master <This works okay> $ git push https://user@server/rhodecode/llvm release_31 Counting objects: 328, done. Delta compression using up to 4 threads. Compressing objects: 100% (131/131), done. Writing objects: 100% (240/240), 98.17 KiB, done. Total 240 (delta 191), reused 153 (delta 108) error: RPC failed; result=22, HTTP code = 500 }}}

I am running Rhodecode through an Apache reverse proxy, but I get the same issue if I try to push directly to 127.0.0.1:5000 so I don't think it's an Apache configuration issue. I've tried with both Git 1.7.1 and 1.7.10.2 clients. Same issue appears with waitress and gunicorn.

Comments (8)

  1. Justin Holewinski reporter

    This seems to fix the particular issue of pushing the LLVM branch, but it opens a whole set of new ones. If I reverse the patch, the following problems go away. :(

    First, if I create a new Git repository in Rhodecode, I can no longer push to it (LLVM example again):

    $ git push https://user@server/rhodecode/llvm2 master
    Password: 
    Counting objects: 650842, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (120303/120303), done.
    Writing objects: 100% (650842/650842), 101.52 MiB | 11.58 MiB/s, done.
    Total 650842 (delta 529765), reused 647793 (delta 526766)
    error: RPC failed; result=22, HTTP code = 501
    

    rhodecode.log:

    2012-06-03 15:14:10.435 DEBUG [rhodecode.lib.middleware.simplegit] pathinfo: /llvm2/git-receive-pack detected as GIT True
    2012-06-03 15:14:10.435 DEBUG [rhodecode.lib.middleware.simplegit] Extracted repo name is llvm2
    2012-06-03 15:14:10.441 DEBUG [beaker.container] lock_creatfunc (didnt wait)
    2012-06-03 15:14:10.441 DEBUG [beaker.container] get_value creating new value
    2012-06-03 15:14:10.443 DEBUG [beaker.container] set_value stored time 1338750850.4439299 expire time 10
    2012-06-03 15:14:10.444 DEBUG [beaker.container] released create lock
    2012-06-03 15:14:10.444 DEBUG [rhodecode.lib.auth] No data in <AuthUser('id:1:None|False')> that could been used to log in
    2012-06-03 15:14:10.444 DEBUG [rhodecode.lib.auth] Auth User is now <AuthUser('id:None:None|False')>
    2012-06-03 15:14:10.459 DEBUG [rhodecode.lib.auth] checking mercurial protocol permissions set([u'repository.read']) for user:default repository:llvm2
    2012-06-03 15:14:10.459 DEBUG [rhodecode.lib.auth] permission denied for user:default on repo:llvm2
    2012-06-03 15:14:10.459 DEBUG [rhodecode.lib.middleware.simplegit] Not enough credentials to access this repository as anonymous user
    2012-06-03 15:14:10.459 DEBUG [rhodecode.lib.middleware.simplegit] Anonymous access is disabled, running authentication
    2012-06-03 15:14:10.459 DEBUG [rhodecode.lib.auth] Received username jholewinski from container
    2012-06-03 15:14:10.460 DEBUG [rhodecode.lib.auth] Auth User lookup by USER ID 4
    2012-06-03 15:14:10.461 DEBUG [rhodecode.model.user] filling <User('id:4:jholewinski')> data
    2012-06-03 15:14:10.461 DEBUG [rhodecode.lib.auth] Auth User is now <AuthUser('id:4:jholewinski|False')>
    2012-06-03 15:14:10.464 DEBUG [rhodecode.lib.auth] checking mercurial protocol permissions set(['repository.admin']) for user:jholewinski repository:llvm2
    2012-06-03 15:14:10.464 DEBUG [rhodecode.lib.auth] permission granted for user:jholewinski on repo:llvm2
    2012-06-03 15:14:10.464 DEBUG [rhodecode.lib.middleware.simplegit] Repository path is /home/rhodecode/repos/llvm2
    2012-06-03 15:14:10.464 DEBUG [beaker.container] lock_creatfunc (didnt wait)
    2012-06-03 15:14:10.464 DEBUG [beaker.container] get_value creating new value
    2012-06-03 15:14:10.465 DEBUG [beaker.container] set_value stored time 1338750850.465831 expire time 10
    2012-06-03 15:14:10.465 DEBUG [beaker.container] released create lock
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[hooks]changegroup.repo_size:python:rhodecode.lib.hooks.repo_size
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[hooks]pretxnchangegroup.push_logger:python:rhodecode.lib.hooks.log_push_action
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[hooks]preoutgoing.pull_logger:python:rhodecode.lib.hooks.log_pull_action
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[extensions]largefiles:
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[web]push_ssl:true
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[web]allow_archive:gz zip bz2
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[web]allow_push:*
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[web]baseurl:/
    2012-06-03 15:14:10.466 DEBUG [rhodecode.lib.utils] settings ui from db[paths]/:/home/rhodecode/repos
    2012-06-03 15:14:10.468 DEBUG [rhodecode.model.db] marking 0 key[s] llvm2 for invalidation
    2012-06-03 15:14:10.468 INFO  [rhodecode.lib.middleware.simplegit] push action on GIT repo "llvm2"
    2012-06-03 15:14:10.468 DEBUG [rhodecode.SimpleGit] Request time: 0.033s
    

    I get another error if I try to push a simple repo to a new Rhodecode repo. If I create a new repo gittest2 in Rhodecode and try to push a simple repo to it, I get this:

    $ git push https://user@server/rhodecode/gittest2 master
    Password: 
    Counting objects: 18, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (10/10), done.
    Writing objects: 100% (18/18), 1.45 KiB, done.
    Total 18 (delta 3), reused 0 (delta 0)
    remote: error: refusing to update checked out branch: refs/heads/master
    remote: error: By default, updating the current branch in a non-bare repository
    remote: error: is denied, because it will make the index and work tree inconsistent
    remote: error: with what you pushed, and will require 'git reset --hard' to match
    remote: error: the work tree to HEAD.
    remote: error: 
    remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
    remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
    remote: error: its current branch; however, this is not recommended unless you
    remote: error: arranged to update its work tree to match what you pushed in some
    remote: error: other way.
    remote: error: 
    remote: error: To squelch this message and still keep the default behaviour, set
    remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
    
  2. Marcin Kuzminski repo owner

    O yes, forgot the make a important note that with the patch you need to work only with bare git repos from now on. That will be a default option in rhodecode 1.4

    Just rm the git-dir do git init --bare removedrepo, and push everything, I know that this patch works stable.

    If you're interested here's a line inside 1.3.6 code that will create new repos as bare see this: https://bitbucket.org/marcinkuzminski/rhodecode/changeset/75280665ad1e

  3. Marcin Kuzminski repo owner

    fyi, latest beta branch has a new implementation based on gitweb. That should be stable enough

  4. Justin Holewinski reporter

    I just installed the beta branch and wiped all repos on the server. Everything seems to be working now! Thanks!

  5. Log in to comment