cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl fd release

From: mm.w <0xcafefeed_at_gmail.com>
Date: Tue, 31 Mar 2015 11:14:16 -0700

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.
>
> >>> Dan
> -------------------------------------------------------------------
> 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-03-31