]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
SignalHandler: fix infinite loop on BSD systems
authorAlan Somers <asomers@gmail.com>
Tue, 8 Oct 2013 22:24:00 +0000 (15:24 -0700)
committerGreg Farnum <greg@inktank.com>
Mon, 14 Oct 2013 18:14:44 +0000 (11:14 -0700)
SignalHandler::entry shouldn't poll for POLLOUT, because it never actually
writes to the pipes in question. Polling for POLLOUT causes poll(2) to
immediately return, so the function spins the CPU and never blocks. Remove
the POLLOUT flag, unnecessarily introduced in commit
8e4a78f169eda716c7d6811cb6db5c757dc67207 when switching from select() to poll().

This fixes the problem on FreeBSD and doesn't break anything (AFAICT) on
Linux. Tested on FreeBSD 9.1 amd64 and Ubuntu Server 13.04 amd64.

Fixes: #6492
Signed-off-by: Alan Somers <asomers@gmail.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/global/signal_handler.cc

index ce604fe1e5d42270e134f0a55c32b6d7f8d8a157..ffdc5402cafe54db1592807b4cd979a4c046e466 100644 (file)
@@ -196,13 +196,13 @@ struct SignalHandler : public Thread {
       lock.Lock();
       int num_fds = 0;
       fds[num_fds].fd = pipefd[0];
-      fds[num_fds].events = POLLIN | POLLOUT | POLLERR;
+      fds[num_fds].events = POLLIN | POLLERR;
       fds[num_fds].revents = 0;
       ++num_fds;
       for (unsigned i=0; i<32; i++) {
        if (handlers[i]) {
          fds[num_fds].fd = handlers[i]->pipefd[0];
-         fds[num_fds].events = POLLIN | POLLOUT | POLLERR;
+         fds[num_fds].events = POLLIN | POLLERR;
          fds[num_fds].revents = 0;
          ++num_fds;
        }