curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to fix libcurl error(easy handled already used in multi handle) ?

From: Dave Reisner via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 13 Feb 2019 07:54:20 -0500

On Tue, Feb 12, 2019 at 06:49:17AM -0800, kishore koney via curl-library wrote:
> Thanks Daniel.
>
> I am not pretty sure when you said " you're adding  one of those handles
> twice."  What does it mean ?
> All that I am using is curl_easy_init(), curl_easy_perform(), curl_easy_cleanup
> APIs. 

Your original email mentions multiple threads. Are you trying to use a
single easy handle across all of the threads, or are you calling
init+perform for each thread? The former scenario would have a high
likelihood of encountering the error you describe.

> I am getting the error(easy handled already used in multi handle) when I called
> curl_easy_init() followed by curl_easy_perform ? Which of these API is adding
> handles twice to ???
>
> thanks, krishna
>
> On Mon, Feb 11, 2019 at 10:48 AM Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Mon, 11 Feb 2019, kishore koney via curl-library wrote:
>
> > I am using *libcurl(version = 7.61.1*]*)* easy API for downloading http
> > url/files(as byte-range chunks). I am getting libcurl_easy_perform()
> return
> > error_code(*2*) and errorBuffer((*easy handled already used in multi
> > handle*). I am opening 10 concurrent active libcurl easy handles as part
> of
> > 10 threads in a process. Is that OK ?
>
> Sure, that's fine. But since this error occurs, it sounds as if you're
> adding
> one of those handles twice.
>
> > Is there any limit on how many concurrent libcurl easy
> > handles(libcurl_easy_init) a process can keep active at a time ?
>
> No. Although you might run into problems when reaching the maximum number
> of
> open file descriptors you can have in a process, which typically defaults
> to
> 1024.
>
> > *I do not get this error all the time but once in a while(1 out of 10
> easy
> > handles). Are there any tips on handling this error ? What context will
> > raise this error ?*
>
> It explains itself: when you try to add a handle to a multi handle that
> already is added to a multi handle.
>
> > Are there any libcurl usergroups/forums where I can post my libcurl
> queries
> > ?
>
> I would say that this is the most suitable one.
>
> --
>
>   / daniel.haxx.se
>

> -------------------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-02-13