curl / Mailing Lists / curl-library / Single Mail


Hang in curl_easy_perform

From: Newton Petersen <>
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:


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:

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

nfds = 1

timeout_ms = 1000

So events = 0x0300 which is
#define POLLRDNORM 0x0100
#define POLLRDBAND 0x0200

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?


Received on 2018-06-20