cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem with CURLE_COULDNT_CONNECT on FTP

From: Jonas Schnelli <jonas.schnelli_at_include7.ch>
Date: Fri, 4 Nov 2011 09:25:38 +0100

>
> Under the high-load simulation, after some minutes, curl_easy_perform responses always with a CURLE_COULDNT_CONNECT (7).
> But the host is still connectable. Sometimes the CURLE_COULDNT_CONNECT comes for only one try, sometimes it's endless returning CURLE_COULDNT_CONNECT.
>
>
> It is not easy to tell without traces taken by setting CURLOPT_VERBOSE option. If your SW is really running fast and leaking sockets, you may be running out of file descriptors needed for socket creation. The error code returning from socket would tell. To easily test, - if your app is launched from a console - just try to decrease it to a lower value like 64 and expect a shorter time span before failure. Below is the command to decrease # of allowed open files
>
> ulimit -a | grep "open files" # check current limit
> # ulimit -n 64 # set a new limit
> ulimit -a | grep "open files" # check updated limit

Yes. You my rescue!
After changing the open file limit the "problems" occurs much faster.
So you theory must be right.

Could it also be that there are unclosed FILE * handles?
I assume that libcurl is not leaking sockets.

I do a propper curl_global_cleanup after i'm finish with "ALL" transfers.

But maybe the problem is "ALL".
Because i like to avoid multiple reconnects i keep the "curl_easy session" open by just calling curl_easy_reset before every file transfer.
I only cleanup after the connection is no longer needen.
But this should not affect the amount of open sockets?

Any ideas are welcome while i try to get the sockets leaking under controll.

Thanks gokhan

> If somebody also works with FTP:
> How do you handle CURLE_COULDNT_CONNECT?
> Do you try to make server tries?
>
>
> You should normally not handle. A proper engineering should protect from traping to this error.

Sound clear. But what if the uses has connected on 3G and there was a timeout because of a net-blackhole?
But yeah, your right, that goes more into the business logic of my software.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-11-04