mbox series

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

Message ID cover.1589393036.git.liu.denton@gmail.com (mailing list archive)
Headers show
Series remote-curl: partial fix for a deadlock with stateless rpc | expand

Message

Denton Liu May 13, 2020, 6:04 p.m. UTC
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/20200328154936.GA1217052@coredump.intra.peff.net/

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(-)