curl-library
Re:Re: libcurl fd release
Date: Wed, 1 Apr 2015 22:55:01 +0800 (CST)
在 2015-04-01 02:14:16,"mm.w" <0xcafefeed_at_gmail.com> 写道:
hello,
you are getting an EBADF errno could be anywhere ; even the targeted file you try to download; as Dan said without any further digging [; meaning finding the spot where it really happens ; meaning again ; I think you have a lack of return/error checking in your code* or a race condition and a lack of sync-lock;] any answer is somehow meaning-less ; or except with a functional crystal-ball which is a really rare item ; never seen one.
Best.
On Tue, Mar 31, 2015 at 10:42 AM, Dan Fandrich <dan_at_coneharvesters.com> wrote:
On Tue, Mar 31, 2015 at 10:49:25PM +0800, 兰天 wrote:
> Hi,all
> I recently encounter a stranger thing:
> I use libcurl to download file ,
> first ,I receive a request from client ,and I then use the url from this
> package to download file , however ,I see the log and find so many error"Bad
> file descryptor",
> when I download a file and I use
> curl_multi_remove_handle(g->multi, easy);
> curl_easy_cleanup(eh);
> these two api to release the resource ,this error may indicate that : I close
> the same fd two times!
> So I have two question :
> 1. how does curl_multi_remove_handle and curl_easy_cleanup to release the fd?
> 2. do I release the same fd two times? I check the code for many times and
> could not find the answer ,could any one help me?
Unless the application is doing weird things behind libcurl's back with file
descriptors and the application is working correctly w.r.t. its multi polling
loop, libcurl should take care of managing them. You don't post any code so we
can't say what is going on in your case.
* About to connect() to xxxx port 80 (#59)* couldn't connect to host* Expire cleare
* getaddrinfo(3) failed for www.xxxx.com:80* Couldn't resolve host 'wwwxxxl.com'* Closing connection #56* Connection #58 to hostxxxx left intact* getaddrinfo(3) failed for www.xxx.com:80* Couldn't resolve host 'www.xxx.com'* Closing connection #59* getaddrinfo(3) failed for www.xxx.com:80* Couldn't resolve host 'www.xxx.com'* Closing connection #59* getaddrinfo(3) failed for www.xxx.com:80* Couldn't resolve host 'www.xxx.com'* Closing connection #59* getaddrinfo(3) failed for www.xxx.com:80* Couldn't resolve host 'www.xxx.com'* Closing connection #53*
Closing connection #55* About to connect() to xxxxxxxxxxxxxxx port 80 (#55)* couldn't connect to host* Expire cleared
these are the screen output information ! the return code is 6 ,or 7 6 means could not resolve the url ,7 means could not connect to the host !I use ping and telnet to verify the url is ok. however ,the log has often appear these two error . and I see the network error is " bad file descriptor" -------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-04-01