-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
libcurl does not finish CURLOPT_UPLOAD request after a connection lost without data tranfer #11769
Comments
I can reproduce. I suspect it is related to the pause state. I have not figured it out yet. What's curios in this scenario is that when the connection goes down and curl reads from the socket: Line 811 in 3f283e9
... it gets a -1 back and If I #ifdef out the sending from the reproducer so that it sends nothing and just waits for data to arrive (that never comes), it instead properly immediately reads a 0 on the connection break and exits as it should. |
I have a fix in #11756 for http2 where the HOLD was not cleared for a closed stream and transfer happily kept at it. Maybe this is in the same area? |
I have mostly figured it out, and it is not like #11756 since this happens with plain old HTTP/1. I'm going to work on writing a test case that reproduces then submit a PR. |
Thank you for the fix! |
Previously this cleared the receiving bit only but in some cases it is also still sending (like a request-body) when disconnected and neither direction can continue then. Fixes curl#11769 Reported-by: Oleg Jukovec Closes curl#11795
I did this
I am trying to use the
libcurl
to communicate with etcd HTTP stream API. The idea of the API to send and receive JSON messages (transferred with https://en.wikipedia.org/wiki/Chunked_transfer_encoding). Everything functions properly until the connection withetcd
is unexpectedly lost. Thelibcurl
does not perform/finishes a request with an error until I actually send some data.The reproducer:
To reproduce:
./etcd
test.c
gcc test.c -lcurl && ./a.out
kill -SIGKILL $(pidof etcd)
I would happily to use an another server to reproduce the error instead of
etcd
if you help me choose a relevant software..I expected the following
I expected that the request finishes (with an error) due to a lost connection. So the reproducer will finish too (it actually happens with a data transfer, see comments in
read_callback
.curl/libcurl version
curl 8.2.1 (x86_64-pc-linux-gnu) libcurl/8.2.1 OpenSSL/3.1.2 zlib/1.3 brotli/1.0.9 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.11.0 nghttp2/1.55.1
Release-Date: 2023-07-26
operating system
Archlinux
Linux host 6.4.11-arch2-1 #1 SMP PREEMPT_DYNAMIC Sat, 19 Aug 2023 15:38:34 +0000 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: