public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: "David Härdeman" <david@hardeman.nu>
To: git@vger.kernel.org
Subject: Issues with git clone over HTTP/2 and closed connections
Date: Sat, 23 Sep 2023 12:58:09 +0000	[thread overview]
Message-ID: <bb757ebd66b5ac4c81d62b01d5cff2f75250090d@hardeman.nu> (raw)

Hi,

I just tried to clone a repo from a server over HTTPS, which failed with a message like this:

  error:  (curl_result = 55, http_code = 0, sha1 = <XYZ>
  error: Unable to find <XYZ> under https://example.com/myrepo.git
  Fetching objects: 20790, done.
  Cannot obtain needed tree <XYZ>
  while processing commit <ABC>
  error: fetch failed.

Every time I retried cloning, <XYZ> and <ABC> changed, but the error message was the same.

By running "GIT_CURL_VERBOSE=1 git clone https://example.com/myrepo.git", I noticed that:

  a) HTTP/2 was being used; and
  b) just before the error the server returned a GOAWAY [1]:
     "== Info: received GOAWAY, error=0, last_stream=1999"

On the client side I'm using Debian Unstable (libcurl 8.3.0, git 2.40.1), and the server is running Debian Stable (nginx 1.22.1-9).

nginx will, by default, close HTTP/2 connections after "http2_max_requests", (default: 1000, i.e. 1999 streams, note that the error message above says last_stream=1999) and it seems that it is using GOAWAY to do so, which seems to confuse git/libcurl.

And sure enough, after running "git config --global http.version HTTP/1.1" on the client and trying again, the "git clone" was successful (I'm guessing I could/should also bump http2_max_requests on the server).

From what I understand, git should close the connection, try to open a new one and resume the clone operation before erroring out (because the GOAWAY message could mean anything).

Is this a known bug and is it something that would need to be fixed in libcurl or in git?

Cheers,
David

PS. Not subscribed, please CC: me on any replies.

[1] https://www.rfc-editor.org/rfc/rfc7540#section-6.8
[2] http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_requests

             reply	other threads:[~2023-09-23 13:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-23 12:58 David Härdeman [this message]
2023-09-24  3:50 ` Issues with git clone over HTTP/2 and closed connections Jeff King
2023-09-24 14:47   ` David Härdeman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb757ebd66b5ac4c81d62b01d5cff2f75250090d@hardeman.nu \
    --to=david@hardeman.nu \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox