Re: [RFC PATCH] http-backend: write error packet if backend command fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 27, 2020 at 10:50:32PM -0400, Denton Liu wrote:

> If one tries to fetch packs with an incorrectly formatted parameter
> while using the smart HTTP protocol v2, the client will block forever.
> This is seen with the following command which does not terminate:
> 
> 	$ git -c protocol.version=2 clone https://github.com/git/git.git --shallow-since=20151012
> 	Cloning into 'git'...

That can't possibly be fixed by a change to http-backend.c, because
github.com does not use git-http-backend. :)

We have a custom proxy layer that terminates the http connection, and
speaks to "upload-pack --stateless-rpc" on the backend. There may be a
bug in that proxy layer, but it's usually pretty robust to upload-pack
hanging up the connection.

But since it works for v1 (which also dies!), and since you were able to
reproduce the problem locally, I suspect it may be an issue in
upload-pack itself.

> This happens because when upload-pack detects invalid parameters, it
> will die(). When http-backend calls finish_command() and detects a
> non-zero exit code, it will simply call exit(1). Since there is no way
> in a CGI script to force a connection to terminate, the client keeps
> blocking on the read(), expecting more output.

When the CGI exits, that should close the descriptor it holds. If the
webserver hands off the socket to the CGI, that would be sufficient. If
it doesn't, then it should notice the CGI exiting and close the socket
itself.

> Write an error packet if the backend command fails to start or finishes
> with an error so that the client can terminate the connection.

This is probably not a good idea; we don't know what state the protocol
was in when the child died.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux