Skip to content

Commit a1a3fd1

Browse files
peffgitster
authored andcommitted
send-pack: avoid deadlock on git:// push with failed pack-objects
Commit 09c9957 fixes a deadlock in which pack-objects fails, the remote end is still waiting for pack data, and we are still waiting for the remote end to say something (see that commit for a much more in-depth explanation). We solved the problem there by making sure the output pipe is closed on error; thus the remote sees EOF, and proceeds to complain and close its end of the connection. However, in the special case of push over git://, we don't have a pipe, but rather a full-duplex socket, with another dup()-ed descriptor in place of the second half of the pipe. In this case, closing the second descriptor signals nothing to the remote end, and we still deadlock. This patch calls shutdown() explicitly to signal EOF to the other side. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ffe853 commit a1a3fd1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin-send-pack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,8 @@ int send_pack(struct send_pack_args *args,
520520
ref->status = REF_STATUS_NONE;
521521
if (args->stateless_rpc)
522522
close(out);
523+
if (git_connection_is_socket(conn))
524+
shutdown(fd[0], SHUT_WR);
523525
if (use_sideband)
524526
finish_async(&demux);
525527
return -1;

0 commit comments

Comments
 (0)