# (Mosty harmless) protocol error when pushing

5 messages from 2010-05-25 to 2010-05-27. Participants: Björn Gustavsson, Jeff King, Ilari Liusvaara.
Thread: https://gitlist.dev/t/23895

## Björn Gustavsson, 2010-05-25 06:51

Subject: (Mosty harmless) protocol error when pushing
Message-ID: <AANLkTikbFaNhiDngY7Cgk0Ce0YhmNBGIpXtn7abjXnPR@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikbFaNhiDngY7Cgk0Ce0YhmNBGIpXtn7abjXnPR%40mail.gmail.com

```
I am not sure whether this has been reported before.
I follow this mailing list, but I don't read all emails in
detail, so I could have missed a bug report or a fix
for the problem.

Anyway, what seems to happen is that some protocol
error happens when an automatic GC is triggered
during a push. The push succeeded, despite the
error messages.

My version of git is 1.7.1.86.g0e460. Here is
what happened (I force-pushed a single branch):

Counting objects: 270, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (71/71), done.
Writing objects: 100% (184/184), 151.33 KiB, done.
Total 184 (delta 157), reused 134 (delta 113)
Auto packing the repository for optimum performance.
fatal: protocol error: bad line length character: Remo
error: error in sideband demultiplexer
To git@github.com:bjorng/otp.git
 + 7651a63...874192d bg/nif_error -> bg/nif_error (forced update)
error: failed to push some refs to 'git@github.com:bjorng/otp.git'

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB

```

## Jeff King, 2010-05-25 07:28

Subject: Re: (Mosty harmless) protocol error when pushing
Message-ID: <20100525072824.GA19612@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20100525072824.GA19612%40coredump.intra.peff.net
In-Reply-To: <AANLkTikbFaNhiDngY7Cgk0Ce0YhmNBGIpXtn7abjXnPR@mail.gmail.com>

```
On Tue, May 25, 2010 at 08:51:34AM +0200, Björn Gustavsson wrote:

> I am not sure whether this has been reported before.
> I follow this mailing list, but I don't read all emails in
> detail, so I could have missed a bug report or a fix
> for the problem.

I haven't seen it before, and I do read most of the emails (OK, I skip
some of the boring ones. :) ).

> Counting objects: 270, done.
> Delta compression using up to 8 threads.
> Compressing objects: 100% (71/71), done.
> Writing objects: 100% (184/184), 151.33 KiB, done.
> Total 184 (delta 157), reused 134 (delta 113)
> Auto packing the repository for optimum performance.
> fatal: protocol error: bad line length character: Remo
> error: error in sideband demultiplexer
> To git@github.com:bjorng/otp.git
>  + 7651a63...874192d bg/nif_error -> bg/nif_error (forced update)
> error: failed to push some refs to 'git@github.com:bjorng/otp.git'

I wasn't able to reproduce here, but I wonder if this would help
(more or less a cut-and-paste from the hook-running code in
receive-pack):

diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index bb34757..c0a6a3b 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -843,7 +843,20 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 			const char *argv_gc_auto[] = {
 				"gc", "--auto", "--quiet", NULL,
 			};
-			run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+			struct child_process proc;
+
+			memset(&proc, 0, sizeof(proc));
+			proc.no_stdin = 1;
+			proc.stdout_to_stderr = 1;
+			proc.err = use_sideband ? -1 : 0;
+			proc.git_cmd = 1;
+			proc.argv = argv_gc_auto;
+
+			if (!start_command(&proc)) {
+				if (use_sideband)
+					copy_to_sideband(proc.err, -1, NULL);
+				finish_command(&proc);
+			}
 		}
 		if (auto_update_server_info)
 			update_server_info(0);

Unfortunately I can't actually test it. :)

-Peff

```

## Björn Gustavsson, 2010-05-26 05:58

Subject: Re: (Mosty harmless) protocol error when pushing
Message-ID: <AANLkTilc9-B79EhmmO2t-VsHFZdupQn8zX9LFYRrn5of@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTilc9-B79EhmmO2t-VsHFZdupQn8zX9LFYRrn5of%40mail.gmail.com
In-Reply-To: <20100525072824.GA19612@coredump.intra.peff.net>

```
2010/5/25 Jeff King <peff@peff.net>:

> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index bb34757..c0a6a3b 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -843,7 +843,20 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
>                        const char *argv_gc_auto[] = {
>                                "gc", "--auto", "--quiet", NULL,
>                        };
> -                       run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
> +                       struct child_process proc;
> +
> +                       memset(&proc, 0, sizeof(proc));
> +                       proc.no_stdin = 1;
> +                       proc.stdout_to_stderr = 1;
> +                       proc.err = use_sideband ? -1 : 0;
> +                       proc.git_cmd = 1;
> +                       proc.argv = argv_gc_auto;
> +
> +                       if (!start_command(&proc)) {
> +                               if (use_sideband)
> +                                       copy_to_sideband(proc.err, -1, NULL);
> +                               finish_command(&proc);
> +                       }
>                }
>                if (auto_update_server_info)
>                        update_server_info(0);
>
> Unfortunately I can't actually test it. :)

Thanks!

Unfortunately, I was also unable to reproduce the problem,
so I can't test it either.

There is no easy way to force a GC on my repository at github,
so I tried to push to a local repository having too many loose
objects using the "file:" protocol but the problem did not occur
(i.e. the repository was auto packed but the protocol error did
not happen).

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB

```

## Ilari Liusvaara, 2010-05-27 11:33

Subject: Re: (Mosty harmless) protocol error when pushing
Message-ID: <20100527113305.GB7865@LK-Perkele-V2.elisa-laajakaista.fi>
URL: https://gitlist.dev/e/20100527113305.GB7865%40LK-Perkele-V2.elisa-laajakaista.fi
In-Reply-To: <AANLkTilc9-B79EhmmO2t-VsHFZdupQn8zX9LFYRrn5of@mail.gmail.com>

```
On Wed, May 26, 2010 at 07:58:29AM +0200, Björn Gustavsson wrote:
> 2010/5/25 Jeff King <peff@peff.net>:
> 
> Unfortunately, I was also unable to reproduce the problem,
> so I can't test it either.
> 
> There is no easy way to force a GC on my repository at github,
> so I tried to push to a local repository having too many loose
> objects using the "file:" protocol but the problem did not occur
> (i.e. the repository was auto packed but the protocol error did
> not happen).

I can't reproduce it either.

I tried testing using git:// over TLS. I could trigger the auto-gc,
but got no messages about it (hmm... other sideband messages do
work...) and no protocol error.

Git 1.7.1 on both sides.

-Ilari

```

## Jeff King, 2010-05-27 15:12

Subject: Re: (Mosty harmless) protocol error when pushing
Message-ID: <20100527151222.GA18590@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20100527151222.GA18590%40coredump.intra.peff.net
In-Reply-To: <20100527113305.GB7865@LK-Perkele-V2.elisa-laajakaista.fi>

```
On Thu, May 27, 2010 at 02:33:05PM +0300, Ilari Liusvaara wrote:

> I can't reproduce it either.
> 
> I tried testing using git:// over TLS. I could trigger the auto-gc,
> but got no messages about it (hmm... other sideband messages do
> work...) and no protocol error.

Same here. But look at Björn's original error, which contained:

  fatal: protocol error: bad line length character: Remo

So I think it may not just be an auto-gc, but an auto-gc which provokes
prune-packed to say:

  Removing duplicate objects: 100% (256/256), done.

which happens only when it takes more than 2 seconds to remove all of
the objects. But I was still not able to reproduce it, even after
removing the delay:

diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c
index f9463de..da1ab20 100644
--- a/builtin/prune-packed.c
+++ b/builtin/prune-packed.c
@@ -48,7 +48,7 @@ void prune_packed_objects(int opts)
 
 	if (opts == VERBOSE)
 		progress = start_progress_delay("Removing duplicate objects",
-			256, 95, 2);
+			256, 95, 0);
 
 	if (len > PATH_MAX - 42)
 		die("impossible object directory");

I notice that the original problem was seen when pushing to github. I
wonder if they are running an older version, or even a custom version
that behaves differently (perhaps with stdout and stderr file
descriptors set up differently for the gc or something like that).

-Peff

```
