Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Re: curl_easy_perform spawns a new thread
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Thomas de Toulmon via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 19 Jul 2022 16:00:35 +0200
Hi Daniel,
Many thanks for your answer.
Indeed I was able to build with the --disable-threaded-resolver option to
configure and that solved the problem.
From the documentation I could not find any bad consequences other than the
name resolution blocking but this is no worries for me as I run in our
internal network and I doubt the DNS would take long. Also that only
happens a few times at the start of the whole process.
Are there any other bad consequences I should be aware of?
Thanks again for your swift answer.
Best,
Thomas
On Tue, Jul 19, 2022 at 11:24 AM Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Tue, 19 Jul 2022, Thomas de Toulmon via curl-library wrote:
>
> > I have the following issue in my code. I call curl_easy_perform (via the
> cpr
> > library) and it spawns a new thread. I was able to verify that this is
> > precisely the call to curl_easy_perform that spawns a new thread and
> > terminates it before returning.
> >
> > Is there a way I can prevent this from happening? I.e. to have
> > curl_easy_perform run in the current thread and prevent it from spawning
> a
> > new thread?
>
> If you use a libcurl built to use the threaded resolver (which is the
> default
> one), libcurl will fire up a new thread for resolving names. That's a
> built-in
> choice. The thread is only used for resolving names and nothing else.
>
> You can opt to build libcurl with the stock synch resolver or with c-ares,
> but
> those choices then come with other possible downsides.
>
> --
>
> / daniel.haxx.se
> | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> | https://curl.se/support.html
>
Date: Tue, 19 Jul 2022 16:00:35 +0200
Hi Daniel,
Many thanks for your answer.
Indeed I was able to build with the --disable-threaded-resolver option to
configure and that solved the problem.
From the documentation I could not find any bad consequences other than the
name resolution blocking but this is no worries for me as I run in our
internal network and I doubt the DNS would take long. Also that only
happens a few times at the start of the whole process.
Are there any other bad consequences I should be aware of?
Thanks again for your swift answer.
Best,
Thomas
On Tue, Jul 19, 2022 at 11:24 AM Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Tue, 19 Jul 2022, Thomas de Toulmon via curl-library wrote:
>
> > I have the following issue in my code. I call curl_easy_perform (via the
> cpr
> > library) and it spawns a new thread. I was able to verify that this is
> > precisely the call to curl_easy_perform that spawns a new thread and
> > terminates it before returning.
> >
> > Is there a way I can prevent this from happening? I.e. to have
> > curl_easy_perform run in the current thread and prevent it from spawning
> a
> > new thread?
>
> If you use a libcurl built to use the threaded resolver (which is the
> default
> one), libcurl will fire up a new thread for resolving names. That's a
> built-in
> choice. The thread is only used for resolving names and nothing else.
>
> You can opt to build libcurl with the stock synch resolver or with c-ares,
> but
> those choices then come with other possible downsides.
>
> --
>
> / daniel.haxx.se
> | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> | https://curl.se/support.html
>
-- Thomas Bottée de Toulmon Market Microstructure Analyst Oryctérope Transalpin SARL, a TransMarket Group Company Rue du Léman 18A, 1920 Martigny +41 27 544 0905 | thomas.de.toulmon_at_ortr.ch
-- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2022-07-19