]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add pipe fd to set for select() in do_curl_wait() 9785/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 17 Jun 2016 02:51:54 +0000 (22:51 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 17 Jun 2016 16:37:42 +0000 (12:37 -0400)
when HAVE_CURL_MULTI_WAIT is 0, the pipe fd is never added to the
readfds for select(), so FD_ISSET() is always false. this prevents us
from ever trying to read from the fd, and the pipe's buffer eventually
fills up and deadlocks callers of RGWHTTPManager::signal_thread() when
they try to write to the pipe

Fixes: http://tracker.ceph.com/issues/16368
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_http_client.cc

index 102ea60d32e752938315995343dda2554a89c1d0..ee1f48a44c16e9a529b0f5985977eb14c01d06d1 100644 (file)
@@ -465,8 +465,11 @@ static int do_curl_wait(CephContext *cct, CURLM *handle, int signal_fd)
     return -EIO;
   }
 
-  if (signal_fd >= maxfd) {
-    maxfd = signal_fd + 1;
+  if (signal_fd > 0) {
+    FD_SET(signal_fd, &fdread);
+    if (signal_fd >= maxfd) {
+      maxfd = signal_fd + 1;
+    }
   }
 
   /* forcing a strict timeout, as the returned fdsets might not reference all fds we wait on */