From: Alan Somers Date: Tue, 8 Oct 2013 22:24:00 +0000 (-0700) Subject: SignalHandler: fix infinite loop on BSD systems X-Git-Tag: v0.72-rc1~67 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6641273b19914a3af098bb3005724bec481e6ce3;p=ceph.git SignalHandler: fix infinite loop on BSD systems 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 Reviewed-by: Greg Farnum --- diff --git a/src/global/signal_handler.cc b/src/global/signal_handler.cc index ce604fe1e5d4..ffdc5402cafe 100644 --- a/src/global/signal_handler.cc +++ b/src/global/signal_handler.cc @@ -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; }