-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
HTTP/2 post issue on latest curl version #7630
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
Comments
Thanks a lot for your report! Can I ask you to provide us with more details on exactly how to go ahead and repeat this. Preferably with a command line or a stand-alone program we can run from our ends against a public URL to trigger the problem? |
This application works by sending the user's voice data to the server and receiving the recognition result from the server as a response. (like the Alexa) The source code is published in the Github repo below.
If you need a more detailed log (full log), I'll reproduce the issue again and share it here. |
I ask you to write a minimum stand-alone program based on your logic, that reproduces the problem and then share that code. I cannot debug your application (unless you sign up for a support contract). You might be able to start off with one of the libcurl examples and then adjust it to work more like your application. |
Ok. As your suggestion, I will prepare an libcurl example and environment that can reproduce the issue easily. |
Hi @bagder, And I configured the build environment so that you can build and test it yourself easily using each of the curl commits I reported(c4e6968 and 842f73d), and also uploaded the test log. |
I'm not sure when/if I'll be able to get through all that. I was hoping for a "run this code then XXX happens". |
I've tried to simplify this issue. However, since it was necessary to create a situation in which two streams (GET stream and POST stream) exist at the same time to reproduce the issue, it was not easy to deliver in the form of simply sharing a piece of code. Also I had to configure and make a sample server to accept these HTTP/2 requests. The logic of the test client(consists of about 240 lines) is simply as follows.
And the abnormal behavior that appears is that the |
I fixed the example to build for Windows (h2curl master...jay:fix_windows_build) but I'm unable to reproduce. In all cases the result was 12 seconds: 842f73d, c4e6968, e8c8775 (master at the time of testing) packet captures of attempted windows repro curl issue 7630.zip Edit: I used 127.5.5.5 as a alternate localhost destination server address to easily distinguish it in Wireshark from the source address 127.0.0.1 Edit 2: I did not use the submodules in the example to build curl, I used release OpenSSL/1.1.1k nghttp2/1.43.0. |
Hi @jay, To check whether the issue really depends on the environment, I tried running it in a clean ubuntu environment through a Github Action. And as a result, if you check the link below, you can see that the abnormal situation is reproduced. Two jobs were run according to the curl commit, and you can see that the results(log) are different. You can also check or download the log file (Artifacts). |
I notice libcurl is calling http2_recv continuously without wait for about 3 seconds... that doesn't look right given the example response
|
I wrote up a piece of code according to the description in here. It first makes a GET and then a POST with read callback over HTTP/2 with reused connection. Then ran it on linux with the latest libcurl and I see no issue. curl 7.79.0-DEV (x86_64-pc-linux-gnu) libcurl/7.79.0-DEV OpenSSL/1.1.1l zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.0) nghttp2/1.43.0 librtmp/2.3 libgsasl/1.10.0 OpenLDAP/2.4.59 The code |
add issue7630.c written by bagder curl/curl#7630 Signed-off-by: Inho Oh <webispy@gmail.com>
add issue7630.c written by bagder curl/curl#7630 Signed-off-by: Inho Oh <webispy@gmail.com>
Thank you for testing. There was a typo in your code, so I modified it as follows and tested it.
The https://curl.se/ server that you used for testing gives a HEADER and BODY response immediately when receiving a GET request, which is different from the situation I described in the ticket. So, I used another server(https://github.com/webispy/h2curl/blob/master/server/index.js) for testing. When this server receives a GET request, it gives only the HEADER response first, and then gives the BODY response 10 seconds later. And as a result, the second POST request works only when the BODY response to the GET request is received.
So my guess is that your example code doesn't fit the issue described in this ticket. (Two requests do not exist at the same time.) |
Then can you please adjust it so that it does? You description mentioned doing two requests over a reused connection so I made my code do that.
Are you now saying that the two requests need to get issued at the same time over the same connection? |
To be precise, when the second POST request(Stream ID-3) is sent while the first GET request(Stream ID-1) is still alive(waiting for body response), the Therefore, this situation is described as a state where two requests exist simultaneously for same connection. I am preparing a diagram to explain this situation a little more accurately. I will try to explain it accurately through a sequence chart as soon as possible. (I apologize if I couldn't explain properly due to poor English.) |
add sequence diagram for normal and abnormal case. curl/curl#7630 Signed-off-by: Inho Oh <webispy@gmail.com>
Thanks for the diagram, but for me it is much more important to be able to reproduce and to check the code when the problem is triggered. |
add curl_multi to handle both get and post requests. curl/curl#7630 Signed-off-by: Inho Oh <webispy@gmail.com>
add curl_multi to handle both get and post requests. curl/curl#7630 Signed-off-by: Inho Oh <webispy@gmail.com>
I modified
Please test with custom server implementation(index.js.txt, 72 lines of code) for test the GET and POST response. You can also download additional files(
You can also check the actual test result log at the link below.
|
Thus function was written to avoid doing multiple connection data initializations, which is fine, but since it also initiates stream related data it is crucial that it doesn't skip those even if called again for the same connection. Solved by moving the stream initializations before the "doing-it-again" check. Reported-by: Inho Oh Fixes #7630
I did this
Currently, I am developing an application that communicates with the server over HTTP/2 using curl + nghttp2 (1.44.0).
So far, I've been using curl library version 7.69.1, and it worked fine.
However, when testing with the latest curl version, a problem occurred, and the test results for each version are as follows.
I tested each commit between 7.70.0 and 7.71.0 one by one to find the commit that made it stop working, and found that the following commit was causing the problem.
I expected the following
Sequence (normal operation case):
CURLOPT_READFUNCTION
invokedCURLOPT_READFUNCTION
invokedCURLOPT_READFUNCTION
invoked0
from callback (no more data to send)But, after the
c4e6968
commit, the step 5 of the above sequence does not proceed.Sequence (abnormal operation case):
CURLOPT_READFUNCTION
invokedCURLOPT_READFUNCTION
invokedI analyzed the curl log for debugging, and the difference between the normal operation case and the abnormal operation case is as follows.
File:
lib/http2.c
Logs for normal case(build with
842f73d
commit):Logs for abnormal case(build with
c4e6968
commit):IMHO, it seems that the
drained_transfer()
function is not called in the above abnormal case log(thestate.drain
value is still remains). So in theCurl_readwrite()
function, theselect_res
value is still set toCURL_CSELECT_IN
, and thereadwrite_upload()
function is not called.curl/libcurl version
curl 7.71.0-DEV
operating system
Linux (armhf)
The text was updated successfully, but these errors were encountered: