curl / Mailing Lists / curl-library / Single Mail

curl-library

Hang in curl_easy_perform

From: Newton Petersen <newton.petersen_at_ni.com>
Date: Tue, 19 Jun 2018 22:12:57 +0000

I am trying to debug a very rare but apparently infinite hang in the winsock select() call from Curl_poll:

        ntdll.dll!ZwWaitForSingleObject
        mswsock.dll!SockWaitForSingleObject
        mswsock.dll!__GSHandlerCheck_SEH
        ws2_32.dll!DPROVIDER::WSPSelect
        ws2_32.dll!select
        curlimpl.dll!Curl_poll
        curlimpl.dll!curl_multi_wait
        curlimpl.dll!easy_transfer
        curlimpl.dll!curl_easy_perform

The timeout passed to select() is one second so this really shouldn't hang and points to this likely being a winsock issue?

Parameters to Curl_poll:

ufds
  fd = 0x0000000000045e10
  events = 0x0300
  revents = 0x0000

nfds = 1

timeout_ms = 1000

So events = 0x0300 which is
#define POLLRDNORM 0x0100
#define POLLRDBAND 0x0200
#define POLLIN (POLLRDNORM | POLLRDBAND)

maxfd = 0xffffffffffffffff
 
so we evidently don't go down this:
      if(ufds[i].fd > maxfd)
        maxfd = ufds[i].fd;

this gets set:
      if(ufds[i].events & (POLLRDNORM|POLLIN))
        FD_SET(ufds[i].fd, &fds_read);

So does this:
      if(ufds[i].events & (POLLRDBAND|POLLPRI))
        FD_SET(ufds[i].fd, &fds_err);

Perhaps interesting: same fd for both fds_read and fds_err?

ptimeout = {tv_sec=0x00000001 tv_usec=0x00000000 }

There is another thread in the executable that is also calling select (unrelated to CURL) but with NULL passed as the timeout parameter. It is blocking as expected.

Any suggestions for additional diagnostics if this ever happens again?

Thanks!

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-06-20