cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: download thread hung in poll()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 3 Nov 2011 10:56:49 +0100 (CET)

On Wed, 2 Nov 2011, Alex Loukissas wrote:

> - Multi-threaded C++ application, with a readData() function that may
> be called from multiple threads.
> - The readData function does (in pseudocode) the following:
> CURL* handle = get a handle from a pool of handles,

So there's also some kind of mutex or semaphore action going on there I
assume?

> - One thread makes a call to readData with a long list of URLs (this
> is the one that's stuck). It only makes a single call to the write
> function and the second (and any subsequent) call is blocked:
>
> (gdb) bt
> #0 0x0000000000821933 in poll ()
> #1 0x000000000055d286 in Curl_socket_ready ()

This is too little information. Does data arrive over the network so that it
hangs wrongly or is it just that the tranfer stalled? Have you disabled
signals in your program? What protocol is it hanging on?

It would really help if you code show us the complete source code of an
application that repeats the problem as otherwise we will mostly just assume
that the problem is in your code and not in libcurl.

> Once no other threads make calls to readData, the first thread eventually
> wakes up and continues

You mean then poll() suddently gets data or times out and it continues? How
can that depend on what the other threads do?

> My question is: would this issue be locking-related?

libcurl itself has no and uses no locks.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-11-03