public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jeff King <peff@peff•net>
To: Shawn Pearce <spearce@spearce•org>
Cc: git <git@vger•kernel.org>
Subject: Re: git push keeps writing after server failure
Date: Fri, 12 Jun 2015 14:12:56 -0400	[thread overview]
Message-ID: <20150612181256.GB9242@peff.net> (raw)
In-Reply-To: <CAJo=hJvzjnLFhF4REBzX=pgFamBfu7hZeZidy_8Rmi_DwwR4Nw@mail.gmail.com>

On Fri, Jun 12, 2015 at 10:31:33AM -0700, Shawn Pearce wrote:

> I did something stupid like trying to push a copy of WebKit[1] into my
> GitHub account. This is ~5.2 GiB of data, which GitHub prefers not to
> accept. Ok ...

Heh, yeah. We cap it at 2G, and if you are going to have a WebKit fork,
we prefer you fork the actual WebKit repo so it shares objects (though
if you have a need to create a new fork network, let me know).

> $ git push --all git@github•com:spearce/wk.git
> Counting objects: 2752427, done.
> Delta compression using up to 12 threads.
> Compressing objects: 100% (442684/442684), done.
> remote: fatal: pack exceeds maximum allowed size
> Writing objects: 100% (2752427/2752427), 5.28 GiB | 8.86 MiB/s, done.
> Total 2752427 (delta 2225007), reused 2752427 (delta 2225007)
> fatal: The remote end hung up unexpectedly
> fatal: The remote end hung up unexpectedly
> 
> Notice GitHub prints "remote: fatal: pack exceeds maximum allowed
> size". That interrupted my "Writing objects" progress meter, and then
> git push just kept going and wrote really really fast (170 MiB/s!)
> until the entire pack was sent.

Sounds like it's writing to a closed fd, then. Which makes sense; I
think we should hang up the socket after writing the "fatal" message
above.

> Shouldn't git push realize its stream is broken and stop writing when
> the peer is all like "uh, no, I'm not going to do that, but thanks for
> trying"?

Hrm. I have this old patch, which was originally written so that "kill
$(pidof git-push)" did not let a rogue pack-objects continue writing.

I'm not sure if that's what is going on here, though. I think we connect
pack-objects directly to the socket. So it sounds more like
"pack-objects --stdout" needs to know to stop writing when writes to the
socket fail.

-- >8 --
Date: Sun, 3 Apr 2011 20:53:08 -0400
Subject: [PATCH] send-pack: kill pack-objects helper on signal or exit

We spawn an external pack-objects process to actually send
objects to the remote side. If we are killed by a signal
during this process, the pack-objects will keep running and
complete the push, which may surprise the user. We should
take it down when we go down.

Signed-off-by: Jeff King <peff@peff•net>
---
 send-pack.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/send-pack.c b/send-pack.c
index 2a64fec..bdf723b 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -67,6 +67,7 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
 	po.in = -1;
 	po.out = args->stateless_rpc ? -1 : fd;
 	po.git_cmd = 1;
+	po.clean_on_exit = 1;
 	if (start_command(&po))
 		die_errno("git pack-objects failed");
 
-- 
2.4.2.752.geeb594a

  parent reply	other threads:[~2015-06-12 18:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12 17:31 git push keeps writing after server failure Shawn Pearce
2015-06-12 17:57 ` Junio C Hamano
2015-06-12 18:12 ` Jeff King [this message]
2015-06-12 18:20   ` Jeff King
2015-06-12 18:50     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150612181256.GB9242@peff.net \
    --to=peff@peff$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=spearce@spearce$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox