-
-
Couldn't load subscription status.
- Fork 6.9k
Description
This is continuation to issues found in 2013 and 2015:
https://sourceforge.net/p/curl/bugs/1275/
https://curl.haxx.se/mail/lib-2015-05/0063.html
Issue 1. This is main problem - as described in links above. Pinpointed that it is caused when all of these are true:
- Uploading file in 4MB POST/PUT reguests to service deployed in Windows Server 2008/IIS 7.5
- Reusing CURL handles (either with curl_easy_reset() or using CURLM)
- Using CURLOPT_POSTFIELDSIZE/CURLOPT_POSTFIELDSIZE_LARGE with CURLOPT_POSTFIELDS
or using CURLOPT_INFILESIZE/CURLOPT_INFILESIZE_LARGE with CURLOPT_READFUNCTION.
Result (reproduceable 100%):
- Request 1 uploads 4MB
- Request 2 uploads 3.45MB (+- 100K) and stucks
- Read function is no longer called.
- CURL timeout happens.
- Request hangs for some time on server side and keeps file locked.
3 workarounds that I know that work:
- Do not use curl_easy_reset(), use curl_easy_init()
- Do not use CURLM for uploads
- Use plain CURLOPT_POSTFIELDS without setting request size manually. However, this does not work for binary uploads as it cannot calculate correct length.
We chose workarounds 1 (2013) and 2 (2015).
Issue 2. Side problem that we found recently with new servers and above workarounds:
- Uploading file in 4MB POST/PUT requests to service deployed in Windows Server 2012/IIS 8.0
- NOT reusing CURL handles and using curl_easy_init() for each request.
Result (varying results, same outcome when fails):
- Upload fails after 100-900MBs, succeeds in rare cases for 1GB file.
- CURL fails with:
"Unknown SSL protocol error in connection to myHostName:443. SSL connect error(CURLE_SSL_CONNECT_ERROR)"
Workaround that I know:
- Use curl_easy_reset() or CURLM.
So now I'm stuck, fixing issue 2 enables issue 1 and vice versa.
I would preffer fixing issue 1 because using CURLM is far more flexible approach. I currently have plain CURL C++ source code talking to specific server if that would help, but no server to test it on. I will try to get public server deployed for reproducing issue 1 but not sure when that could be.
Any ideas so far how to solve hanging upload?
Why would using plain CURLOPT_POSTFIELDS fix issue 1?
libCURL:7.50.3
OpenSSL:1.0.2j
Client OS: iOS/Windows x64