# "git clone --depth=2 git://git.sv.gnu.org/gnulib" hangs

4 messages from 2011-04-25 to 2011-04-26. Participants: Jim Meyering, Andreas Schwab, Jeff King.
Thread: https://gitlist.dev/t/27175

## Jim Meyering, 2011-04-25 20:28

Subject: "git clone --depth=2 git://git.sv.gnu.org/gnulib" hangs
Message-ID: <87aafedqjp.fsf@rho.meyering.net>
URL: https://gitlist.dev/e/87aafedqjp.fsf%40rho.meyering.net

```
Hello,

We've had a report that this command is hanging:

    git clone --depth=2 git://git.sv.gnu.org/gnulib

cloning without --depth=N works, as well as when using an ssh:// URL,
but most people can use ssh:// URLs.

Normally it wouldn't be much of a problem, but many projects
use gnulib as a submodule, and one of the recommended (scripted)
ways to get a copy is via a shallow clone.

savannah's server is running git-1.7.2.5.
I've confirmed it using these client versions:

    1.7.5.rc3.316.gd1ff9
    1.7.4.4

GIT_TRACE didn't give much info:

    xx$ GIT_TRACE=1 git clone --depth 2 git://git.sv.gnu.org/gnulib
    trace: built-in: git 'clone' '--depth' '2' 'git://git.sv.gnu.org/gnulib'
    Cloning into gnulib...
    trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' \
      '--keep=fetch-pack 645 on xx.meyering.net'
    trace: exec: 'git' 'index-pack' '--stdin' '-v' '--fix-thin' \
      '--keep=fetch-pack 645 on xx.meyering.net'
    trace: built-in: git 'index-pack' '--stdin' '-v' '--fix-thin' \
      '--keep=fetch-pack 645 on xx.meyering.net'

It appears to be something specific to the gnulib repository,
since I can do a shallow clone of e.g., this one just fine:

    git://git.savannah.gnu.org/parallel.git

Any hints?

At worst I'll set up a git server on a private system and debug it --
eventually.

Regards,

Jim

```

## Andreas Schwab, 2011-04-25 21:16

Subject: Re: "git clone --depth=2 git://git.sv.gnu.org/gnulib" hangs
Message-ID: <m2ipu2f2wc.fsf@igel.home>
URL: https://gitlist.dev/e/m2ipu2f2wc.fsf%40igel.home
In-Reply-To: <87aafedqjp.fsf@rho.meyering.net>

```
Jim Meyering <jim@meyering.net> writes:

> We've had a report that this command is hanging:
>
>     git clone --depth=2 git://git.sv.gnu.org/gnulib
>
> cloning without --depth=N works, as well as when using an ssh:// URL,
> but most people can use ssh:// URLs.

When cloing without --depth I see the resolving deltas phase busy for a
minute at 50%.  Perhaps related?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Jeff King, 2011-04-26 07:59

Subject: Re: "git clone --depth=2 git://git.sv.gnu.org/gnulib" hangs
Message-ID: <20110426075917.GA26874@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110426075917.GA26874%40sigill.intra.peff.net
In-Reply-To: <87aafedqjp.fsf@rho.meyering.net>

```
On Mon, Apr 25, 2011 at 10:28:10PM +0200, Jim Meyering wrote:

> We've had a report that this command is hanging:
> 
>     git clone --depth=2 git://git.sv.gnu.org/gnulib

It might be related to this deadlock which impacts upload-pack on a
server with pthreads serving a shallow clone:

  http://thread.gmane.org/gmane.comp.version-control.git/170789

Unfortunately the fix I posted is not yet in any released version of
git. It is in the current 'next'.

> It appears to be something specific to the gnulib repository,
> since I can do a shallow clone of e.g., this one just fine:
> 
>     git://git.savannah.gnu.org/parallel.git

It's a race condition on filling up a rev-list buffer, so certain repos
may be more prone to triggering the race than others.

-Peff

```

## Jim Meyering, 2011-04-26 16:02

Subject: Re: "git clone --depth=2 git://git.sv.gnu.org/gnulib" hangs
Message-ID: <87bozt9f23.fsf@rho.meyering.net>
URL: https://gitlist.dev/e/87bozt9f23.fsf%40rho.meyering.net
In-Reply-To: <20110426075917.GA26874@sigill.intra.peff.net>

```
Jeff King wrote:
> On Mon, Apr 25, 2011 at 10:28:10PM +0200, Jim Meyering wrote:
>> We've had a report that this command is hanging:
>>
>>     git clone --depth=2 git://git.sv.gnu.org/gnulib
>
> It might be related to this deadlock which impacts upload-pack on a
> server with pthreads serving a shallow clone:
>
>   http://thread.gmane.org/gmane.comp.version-control.git/170789

Thanks for the pointer.  That looks very promising.

Hoping to be able to test your fix, I rsync'd the offending repository to
a system on which I can experiment safely, but so far have been unable
to reproduce the failure there.  Of course, if my problem is indeed due
to the race condition bug that your patch fixes, it's not surprising
that it is unreproducible in a different environment.

> Unfortunately the fix I posted is not yet in any released version of
> git. It is in the current 'next'.

```
