cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: download thread hung in poll()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 8 Nov 2011 09:26:34 +0100 (CET)

On Mon, 7 Nov 2011, Alex Loukissas wrote:

> (gdb) frame 1
> #1 0x0000000000561674 in Curl_socket_ready (readfd=20, writefd=-1,
> timeout_ms=1000) at select.c:215
> 215 r = poll(pfd, num, pending_ms);
> (gdb) print pfd
> $1 = {{fd = 20, events = 195, revents = 0}, {fd = 5811065, events = 0,
> revents = 0}}

Doesn't this simply "hang" for 1000 milliseconds and then it continues?

> From what I understand, poll is hung on a bad write file descriptor,
> correct?

Why would it be bad? To me it looks perfectly legitimate. It sits there
waiting for network traffic to arrive on the socket, file descriptor 20 in
this specific case.

If you set a progress callback for this handle, I bet you'll see it get called
repeatedly while it waits for data to arrive.

If you wireshark the network while it poll()s you should be able to verify
that no traffic arrives. If you still see traffic arriving, you need to figure
out why poll() doesn't react to it. I find it unlikely that libcurl would pass
the wrong file descriptor to the poll() call there. But of course until we
know the actual reason for this effect I can't rule anything out with 100%
certainty.

-- 
  / 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-08