KeyError on fetch (pack/thinpack)

Bug #783456 reported by Julien Danjou
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Dulwich
Triaged
Medium
Unassigned

Bug Description

What I'm doing is that I'm building a repository using Dulwich on one
side, and fetching a refs (using Client.fetch) on the other side in
another repository. Nothing fancy.

This is the backtrace I get once in a while:
  File "remote.py", line 125, in fetch
    return self.client.fetch(self.path, self.storage, determine_wants, self.FetchProgress)
  File "/usr/local/lib/python2.6/dist-packages/dulwich/client.py", line 211, in fetch
    commit()
  File "/usr/local/lib/python2.6/dist-packages/dulwich/object_store.py", line 475, in commit
    return self.move_in_pack(path)
  File "/usr/local/lib/python2.6/dist-packages/dulwich/object_store.py", line 431, in move_in_pack
    entries = p.sorted_entries()
  File "/usr/local/lib/python2.6/dist-packages/dulwich/pack.py", line 888, in sorted_entries
    ret = list(self.iterentries(progress=progress))
  File "/usr/local/lib/python2.6/dist-packages/dulwich/pack.py", line 878, in iterentries
    type, obj = self.resolve_object(offset, type, obj)
  File "/usr/local/lib/python2.6/dist-packages/dulwich/pack.py", line 852, in resolve_object
    base_offset, type, base_obj = get_ref(basename)
  File "/usr/local/lib/python2.6/dist-packages/dulwich/pack.py", line 824, in get_ref
    raise KeyError(sha)
KeyError: 'C\x9ag&\x1e\x15\x0f\x8e\xd7 \x10a\x9e\x8e\xab\xf5\x80f6\xf0'

When this happens, it always happens: I mean doing another fetch on the
same ref using Dulwich raises the same exception.

Jelmer told me:
> Can you try changing add_pack() to add_thin_pack() in
> dulwich/client.py ?

And this actually seems to solve the problem.

Tags: patch
Jelmer Vernooij (jelmer)
Changed in dulwich:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

What sort of changes did you make exactly? add_thin_pack() takes different arguments from add_pack(), so as far as I can tell just replacing them is not sufficient.

Revision history for this message
Julien Danjou (jdanjou) wrote :

@@ -203,7 +203,7 @@ class GitClient(object):
         """
         if determine_wants is None:
             determine_wants = target.object_store.determine_wants_all
- f, commit = target.object_store.add_pack()
+ f, commit = target.object_store.add_thin_pack()

Revision history for this message
Julien Danjou (jdanjou) wrote :

That was on commit 3cafa9c14e1781fec011da66b5a44180f8b8e858. If thing changed since then, I can't help much more. :-)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.