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

Re: [PATCH v2 3/3] http: automatically retry some requests

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Oct 13, 2020, 23:45 UTC
Message-ID
<20201013234502.GB490427@camp.crustytoothpaste.net>
In-Reply-To
<20201013211453.GB3678071@coredump.intra.peff.net>
On 2020-10-13 at 21:14:53, Jeff King wrote:
Show 12 quoted lines
> On Tue, Oct 13, 2020 at 01:17:29PM -0600, Sean McAllister wrote:
> >  static int http_request(const char *url,
> >  			void *result, int target,
> >  			const struct http_get_options *options)
> >  {
> 
> It looks like you trigger retries only from this function. But this
> doesn't cover all http requests that Git makes. That might be sufficient
> for your purposes (I think it would catch all of the initial contact),
> but it might not (it probably doesn't cover subsequent POSTs for fetch
> negotiation nor pack push; likewise I'm not sure if it covers much of
> anything after v2 stateless-connect is established).

Yeah, I was about to mention the same thing. It looks like we cover only a subset of requests. Moreover, I think this feature is going to practically fail in some cases and we need to either document that clearly or abandon this effort.

In remote-curl.c, we have post_rpc, which does a POST request to upload data for a push. However, if the data is larger than the buffer, we stream it using chunked transfer-encoding. Because we're reading from a pipe, that data cannot be retried: the pack-objects stream will have ended.

That's why we have code to force Expect: 100-continue for Kerberos (Negotiate): it can require a 401 response from the server with valid data in order to send a valid Authorization header, and without the 100 Continue response, we'd have uploaded all the data just to get the 401 response, leading to a failed push.

The only possible alternative to this is to increase the buffer size (http.postBuffer) and I definitely don't want to encourage people to do that. People already get the mistaken idea that that's a magic salve for all push problems and end up needlessly allocating gigabytes of memory every time they push. Encouraging people to waste memory because the server might experience a problem puts the costs of unreliability on the users instead of on the server operators where it belongs.

So the only sane thing to do here is to make this operation work only for fetch requests, since they are the only thing that can be safely retried in the general case without consuming excessive resources. As a result, we may want to add appropriate tests for the push case that we don't retry those requests.

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Jeff KingNext: Jeff King
Message 14 of 30 in “remote-curl: add testing for intelligent retry for HTTP”
  1. 1/3 remote-curl: add testing for intelligent retry for HTTPSean McAllister, Oct 13, 2020
  2. 2/3 replace CURLOPT_FILE With CURLOPT_WRITEDATASean McAllister, Oct 13, 2020
  3. Junio C HamanoOct 13, 2020
  4. Jeff KingOct 13, 2020
  5. Daniel StenbergOct 13, 2020
  6. Jeff KingOct 14, 2020
  7. Sean McAllisterOct 14, 2020
  8. Sean McAllisterOct 14, 2020
  9. 3/3 http: automatically retry some requestsSean McAllister, Oct 13, 2020
  10. Junio C HamanoOct 13, 2020
  11. Sean McAllisterOct 14, 2020
  12. Junio C HamanoOct 14, 2020
  13. Jeff KingOct 13, 2020
  14. brian m. carlsonOct 13, 2020
  15. Jeff KingOct 14, 2020
  16. Sean McAllisterOct 14, 2020
  17. Sean McAllisterOct 14, 2020
  18. Jeff KingOct 14, 2020
  19. Sean McAllisterOct 14, 2020
  20. Jonathan NiederOct 15, 2020
  21. Jeff KingOct 15, 2020
  22. Junio C HamanoOct 15, 2020
  23. Jeff KingOct 14, 2020
  24. Sean McAllisterOct 14, 2020
  25. Jeff KingOct 15, 2020
  26. Sean McAllisterOct 15, 2020
  27. Junio C HamanoOct 13, 2020
  28. Sean McAllisterOct 14, 2020
  29. Junio C HamanoOct 14, 2020
  30. Sean McAllisterOct 14, 2020

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.