git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git push keeps writing after server failure

From
Jeff King <peff@peff.net>
Date
Jun 12, 2015, 18:12 UTC
Message-ID
<20150612181256.GB9242@peff.net>
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).

Show 14 quoted lines
> $ 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
Previous: Junio C HamanoNext: Jeff King
Message 3 of 5 in “git push keeps writing after server failure”
  1. Shawn PearceJun 12, 2015
  2. Junio C HamanoJun 12, 2015
  3. Jeff KingJun 12, 2015
  4. Jeff KingJun 12, 2015
  5. Jeff KingJun 12, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.