-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Is short bursts of busyloop normal with HTTP/2 despite no activity? #16084
Comments
More verbose logs after the request finishes
|
Removing data_pending check from https://github.com/curl/curl/blob/master/lib/transfer.c#L357 seems to fix the "problem" here, though I don't know what else breaks if I do that. I guess the problem here is that readwrite_data seems to be meant for recvs, but the data_pending filter in http2 returns true for either of recv and send cases. And so the POST transfer here marks itself as "try me again immediately" just because it has some pending data in sendbuf, in a function that cares about reads. So it just retries infinitely until the socket is actually writable despite not getting any legit socket activity from poll or a prior send() call suggesting to do that. |
The h2 filter mistakenly also checked `sendbuf` when asked about pending data. The call is only meant to account for buffered data that still needs to be received. Also, remove obsolete recvbuf in stream as we write received headers and data directly. refs curl#16084
Thanks, @denizsokmen for the report. The behaviour of the HTTP/2 filter was indeed wrong. The semantics for I propose to fix this via #16098. |
Discussed in #16080
Originally posted by denizsokmen January 24, 2025
I wasn't sure to create this as an issue, as I also haven't dived into it myself. I use multi interface with libcurl 8.9.1 and nghttp2 1.63.0, I have a typical loop in a thread that takes requests, does curl_multi_perform, processes messages, calls curl_multi_poll to avoid busyloop. I noticed that in some of the HTTP/2 requests, curl_multi_poll returns immediately with no numfds set, hundreds of times just to send 80KB of data at the end. There's simply no activity on any sockets until the last step where 80KB data is finally sent:
In summary, something is setting the timeout to 0 in http/2 requests, turning the downloader thread into a busyloop. Is this normal?
The text was updated successfully, but these errors were encountered: