Menu

#843 100% CPU Usage and Error 55

closed-works-for-me
SCP/SFTP (19)
5
2014-08-13
2009-07-05
guideX
No

Versions:
- libssh2-1.1
- zlib 1.2.3
- curl 7.19.5
- openssl 0.9.8k
- MS Visual C++ 2008 SP1
- Compiled on Windows Server 2008
- Program with Curl In use on Windows Server 2003 RC4
- .NET Framework 3.5

I used the Using-libcurl-with-SSH-support-in-Visual-Studio-2008.pdf tutorial which is on the Curl homepage co compile curl, and I used the code in C++ located at the bottom of this message. The files are large in size, something like 2 GB to 55 GB, sometimes it takes over a day to transfer these files, when it does, I go to the console app and it says 'File Upload Failed! Error 55'. On the error list page, that error means 'Failed sending network data.', and when I look at the processes, I see 100% CPU usage, and the whole server is sluggish. I have to end task on the console app which has libcurl, and restart it, and the resulting file is incomplete. Please help or let me know what to do.

Here's the code it fails on ...

void SSHUpload(char * strSource, char * strDestination) {
CURL * hCurl;
CURLcode ccCurlResult = CURL_LAST;
curl_off_t cotFileSize;
HANDLE hFile;
LARGE_INTEGER liFileSize;
hFile = CreateFileA(strSource, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile != INVALID_HANDLE_VALUE)
{
ccCurlResult = curl_global_init(CURL_GLOBAL_WIN32);
if(ccCurlResult == 0)
{
hCurl = curl_easy_init();
if(hCurl) {
curl_easy_setopt(hCurl, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(hCurl, CURLOPT_UPLOAD, TRUE);
GetFileSizeEx(hFile, &liFileSize);
cotFileSize = liFileSize.QuadPart;
curl_easy_setopt(hCurl, CURLOPT_INFILESIZE_LARGE, cotFileSize);
curl_easy_setopt(hCurl, CURLOPT_NOPROGRESS, FALSE);
curl_easy_setopt(hCurl, CURLOPT_PROGRESSFUNCTION, upload_transfer_progress);
curl_easy_setopt(hCurl, CURLOPT_READFUNCTION, read_data);
curl_easy_setopt(hCurl, CURLOPT_READDATA, hFile);
curl_easy_setopt(hCurl, CURLOPT_URL, strDestination);
curl_easy_setopt(hCurl, CURLOPT_PORT, 22);
curl_easy_setopt(hCurl, CURLOPT_USERPWD, "root:password");
curl_easy_setopt(hCurl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_PASSWORD);
printf("Uploading\n");
ccCurlResult = curl_easy_perform(hCurl);
curl_easy_cleanup(hCurl);
}
}
CloseHandle(hFile);
curl_global_cleanup();
if (ccCurlResult == CURLE_OK)
printf("File Uploaded.");
else
printf("File Upload Failed! %d\n", ccCurlResult);
}
else
printf("File Upload Failed! Could not open local file!");
}

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2009-07-05

    The code that diplsays the error message is clearly in your app. How come you then blame libcurl for the 100% CPU?

    I would also encourage you to check the code and see if that resume stuff actually works. Have you tried to enforce that and tried the functionality with just a few small files?

    In general it will help us if you can research more on the EXACT circumstances when the bug happens. Alternatively, please provide an example we can use to repeat the problem.

     
  • Daniel Stenberg

    Daniel Stenberg - 2009-07-08
    • labels: 101476 --> SCP/SFTP
    • milestone: --> bad_behaviour
    • status: open --> pending-works-for-me
     
  • Daniel Stenberg

    Daniel Stenberg - 2009-07-08

    Thanks for reporting this issue and helping us improve curl and libcurl.

    We're awaiting feedback in this issue. Due to this, I have set the state of this issue to pending and it will automatically get closed later on unless we get further info.

    Please consider answering the outstanding questions or providing the missing info so that we can proceed to resolve this issue!

     
  • SourceForge Robot

    • status: pending-works-for-me --> closed-works-for-me
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
MongoDB Logo MongoDB