New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP2 sends spurious PRIORITY packet on duplicated handles #4303
Comments
It looks like twitter.com is no longer failing when this spurious message is sent, but there's still an argument that it shouldn't be sent. |
To make sure that the HTTP/2 state is initialized correctly for duplicated handles. It would otherwise easily generate "spurious" PRIORITY frames to get sent over HTTP/2 connections when duplicated easy handles were used. Reported-by: Daniel Silverstone Fixes #4303
Thanks for this report and sorry for being slow on the ball. Can you please try out the patch in #4442 and see if that fixes the problem for you? |
Irritatingly Twitter have made themselves less succeptible to this, so I can't directly test the fix in #4442 -- however if cURL has |
Cool, thanks. I'll add an assert to the fix as you suggest and merge. |
I did this
curl_easy_init()
ed handle and stashed it away.curl_easy_duphandle()
https://twitter.com/
using that duplicated handleI expected the following
What happened instead
PRIORITY
message was sent for stream-1
RST_STREAM
for stream-1
curl/libcurl version
curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1c zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
operating system
Debian Buster (amd64)
Diagnosis
I spent a few hours working through this before discovering the unexpected
PRIORITY
message. Once I had tracked this down, I pared back why it was occurring and discovered that inhttp2.c
insideh2_session_send()
where the new weight and/or dependency detection logic exists, the value ofdata->state.stream_weight
was zero whereas the value ofdata->set.stream_weight
was 16 (which I determined was the default weight from nghttp2).Tracking through the places where
state.stream_weight
is set, onlyCurl_http2_init_state()
and theduphandle()
called bypush_promise()
look useful. (Both inhttp2.c
)Possible ameliorations
One approach is simply in
h2_session_send()
after the call toh2_pri_spec()
to only queue thePRIORITY
packet ifstream_id
is not-1
. Using a patch to this effect, I was able to fetch twitter.com usefully in my program.Another approach, and perhaps the preferable one, would be to find the right place for
Curl_http2_init_state()
to be called during the point at which the HTTP connection is upgraded to HTTP2. Perhaps duringCurl_http2_setup_conn()
?I am not well-enough versed in the core of the library to make the right call here, but certainly sending a
PRIORITY
message to stream-1
seems very broken to me, and also totwitter.com
's web server 😁The text was updated successfully, but these errors were encountered: