repo, clone depth=1 and stack overflow

1,158 views
Skip to first unread message

Felix Hall

unread,
Jan 9, 2015, 11:27:26 AM1/9/15
to repo-d...@googlegroups.com
Hi,

We've encountered an error in repo on a few rare occasions when working with clone-depth=1 in our manifest.
I've been able to reproduce it on a certain production git, but have yet to produce a minimal test git with the problem.

A mock-up of the manifest contains the following:
<project clone-depth="1" groups="group" name="platform/some/name" path="some/name" revision="0123456789abcdef0123456789abcdef01234567" upstream="xyz/dev"/>

When performing repo sync here, we get stuck and python bails at stack depth 1000.

Exception RuntimeError: RuntimeError('maximum recursion depth exceeded',) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
Exception in thread Thread-120:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/myname/somedir/.repo/repo/subcmds/sync.py", line 234, in _FetchProjectList
    success = self._FetchHelper(opt, project, *args, **kwargs)
  File "/home/myname/somedir/.repo/repo/subcmds/sync.py", line 275, in _FetchHelper
    no_tags=opt.no_tags, archive=self.manifest.IsArchive)
  File "/home/myname/somedir/.repo/repo/project.py", line 1114, in Sync_NetworkHalf
    self._InitMRef()
  File "/home/myname/somedir/.repo/repo/project.py", line 2148, in _InitMRef
    self._InitAnyMRef(R_M + self.manifest.branch)
  File "/home/myname/somedir/.repo/repo/project.py", line 2160, in _InitAnyMRef
    self.bare_git.UpdateRef(ref, dst, message = msg, detach = True)
  File "/home/myname/somedir/.repo/repo/project.py", line 2406, in UpdateRef
    self.update_ref(*cmdv)
  File "/home/myname/somedir/.repo/repo/project.py", line 2483, in runner
    p.stderr))
GitError: platform/some/name update-ref: fatal: 0123456789abcdef0123456789abcdef01234567^0: not a valid SHA1

Stepping it through, I've reached the _RemoteFetch() in project.py, in the end of which we're doing the following:

    if is_sha1 and current_branch_only and self.upstream:
      # We just synced the upstream given branch; verify we
      # got what we wanted, else trigger a second run of all
      # refs.
      if not self._CheckForSha1():
        return self._RemoteFetch(name=name, current_branch_only=False,
                                 initial=False, quiet=quiet, alt_dir=alt_dir)

However, _CheckForSha1() checks whether the sha1 is correct by trying to find its parent through "git-rev-parse --verify 0123456789abcdef0123456789abcdef01234567^0", which 
will fail if the clone-depth is 1. In case of failure, we recurse with the same parameters as last time...

Do we need to add a special case here in case depth=1? Or is there something else that might be fishy?
We don't see this problem often, but it has happened occasionally.

Thankful for any advice on how to proceed!

Regards,
Felix

Felix Hall

unread,
Jan 12, 2015, 7:00:08 AM1/12/15
to repo-d...@googlegroups.com
Version info btw:

repo version v1.12.16
repo launcher version 1.21
       (from /usr/bin/repo.vanilla)
git version 1.8.2.2
Python 2.7.3 (default, Feb 27 2014, 19:58:35) 
[GCC 4.6.3]

Felix Hall

unread,
Feb 9, 2015, 7:25:15 AM2/9/15
to repo-d...@googlegroups.com, david.pu...@sonymobile.com
Should I put this in a new issue, or is there any more info I should add first?
@David, any ideas how to proceed?

Regards,
Felix
Reply all
Reply to author
Forward
0 new messages