cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl fd release

From: Dan Fandrich <>
Date: Tue, 31 Mar 2015 19:42:34 +0200

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:
Received on 2015-03-31