Thanks to visit codestin.com
Credit goes to github.com

Skip to content

HTTPS upload hangs using Windows Server 2008  #1294

@lietusme

Description

@lietusme

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%):

  1. Request 1 uploads 4MB
  2. Request 2 uploads 3.45MB (+- 100K) and stucks
  3. Read function is no longer called.
  4. CURL timeout happens.
  5. Request hangs for some time on server side and keeps file locked.

3 workarounds that I know that work:

  1. Do not use curl_easy_reset(), use curl_easy_init()
  2. Do not use CURLM for uploads
  3. 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):

  1. Upload fails after 100-900MBs, succeeds in rare cases for 1GB file.
  2. CURL fails with:
    "Unknown SSL protocol error in connection to myHostName:443. SSL connect error(CURLE_SSL_CONNECT_ERROR)"

Workaround that I know:

  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions