Subject: [PATCH 0/6] remote-curl: partial fix for a deadlock with stateless rpc

From: Denton Liu <[email-masked]>
Date: Wed, 13 May 2020 14:04:52 -0400

The following command hangs forever:

	$ git -c protocol.version=2 clone https://github.com/git/git.git --shallow-since=20151012
	Cloning into 'git'...

This occurs because the --shallow-since arg is incorrect and the server
dies early. However, remote-curl does not realise that the server
errored out and just faithfully forwards the packets to fetch-pack
before waiting on more input from fetch-pack. Meanwhile, fetch-pack
keeps reading as it still expects more input. As a result, the processes
deadlock. Original analysis by Peff:
https://lore.kernel.org/git/[email-masked]/

This isn't a full fix as it may still be possible to deadlock, as
described in the last commit message. However, this patch is probably
better than nothing as it fixes the reported bug. I've been working on
the proper reframing fix on-and-off for the past while but it seems
considerably more complicated so it'll probably take a while for me to
get it to a ready state.

Denton Liu (6):
  remote-curl: fix typo
  remote-curl: remove label indentation
  transport: combine common cases with a fallthrough
  pkt-line: extern packet_length()
  remote-curl: error on incomplete packet
  remote-curl: ensure last packet is a flush

 pkt-line.c             |  2 +-
 pkt-line.h             |  5 ++++
 remote-curl.c          | 58 +++++++++++++++++++++++++++++++++++++++---
 t/t5702-protocol-v2.sh | 17 +++++++++++++
 transport.c            | 10 +++-----
 5 files changed, 81 insertions(+), 11 deletions(-)

-- 
2.26.2.706.g87896c9627