cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy hanging with threads

From: Aaron Meriwether <me_at_ameriwether.com>
Date: Wed, 9 Sep 2015 23:56:31 -0600

> On Sep 9, 2015, at 2:43 PM, Aaron Meriwether <me_at_ameriwether.com> wrote:
>
>> On Jul 1, 2015, at 4:17 AM, Aaron Meriwether <me_at_ameriwether.com> wrote:
>>> On Jul 1, 2015, at 4:14 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>>>
>>> On Tue, 30 Jun 2015, Aaron Meriwether wrote:
>>>
>>>> Process hangs (sometimes) when making sequential requests from multiple threads. Any idea what's going wrong?
>>>
>>> Using those exact URLs (and protocols) from the example?
>>>
>>> At what point does it hang and for how long?
>>>
>>
>> Yes, the exact URLs from the example.
>> It hangs indefinitely (at least a few minutes) during about one out of 3 runs.
>> It also does the same if I reuse the curl instance for the two requests per thread.
>
> I had been compiling against Debian's libcurl4-gnutls-dev version 7.26.0-1+wheezy13 when I experienced this issue. After switching to the "openssl" alternative package (libcurl4-openssl-dev 7.26.0-1+wheezy13), I no longer experience the bug, so I suppose it is some quirk of the gnutls library.

Well, it looks like that wasn't the issue after all - I seem to have been missing the "-lpthreads" linker option. For some reason, the build system on Debian Wheezy didn't complain, and the program would compile and run normally most of the time, except for the occasional hang. I upgraded the dev system to Jessie, and gcc began complaining about the missing linkage. So I added "-lpthreads", and the issue seems to have gone away entirely, but I am not able to easily verify whether adding this option would have fixed it on Wheezy (I assume so).

-Aaron
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-09-10