]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: use SIGUSR2 for pipe kills, USR1 for accepter kills
authorSage Weil <sage@newdream.net>
Tue, 14 Jul 2009 23:33:55 +0000 (16:33 -0700)
committerSage Weil <sage@newdream.net>
Tue, 14 Jul 2009 23:33:55 +0000 (16:33 -0700)
Otherwise our pthread sigmask change for accepter pselect() call
can block signals sent to kill pipe threads, and we get hangs on
msgr shutdown.

src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h

index 18124ad80c0a07f86298ecae665c57403890ac12..7b8e8ca811f51930d383536c9072ae30dcad621a 100644 (file)
@@ -161,6 +161,7 @@ int SimpleMessenger::Accepter::start()
   sa.sa_flags = 0;
   sigemptyset(&sa.sa_mask);
   sigaction(SIGUSR1, &sa, NULL);
+  sigaction(SIGUSR2, &sa, NULL);
   sigaction(SIGPIPE, &sa, NULL);  // mask SIGPIPE too.  FIXME: i'm quite certain this is a roundabout way to do that.
 
   // start thread
@@ -676,7 +677,7 @@ int SimpleMessenger::Pipe::accept()
   dout(10) << "accept replacing " << existing << dendl;
   existing->state = STATE_CLOSED;
   existing->cond.Signal();
-  existing->reader_thread.kill(SIGUSR1);
+  existing->reader_thread.kill(SIGUSR2);
   existing->unregister_pipe();
     
   // steal queue and out_seq
@@ -1145,10 +1146,12 @@ void SimpleMessenger::Pipe::stop()
   dout(10) << "stop" << dendl;
   state = STATE_CLOSED;
   cond.Signal();
+  if (sd >= 0)
+    ::close(sd);
   if (reader_running)
-    reader_thread.kill(SIGUSR1);
+    reader_thread.kill(SIGUSR2);
   if (writer_running)
-    writer_thread.kill(SIGUSR1);
+    writer_thread.kill(SIGUSR2);
 }
 
 
index d25d58189a192ff2b619d810daf7c7d49cbc9f2d..c088003b0255353a4c8784a6a80140cd3f229ae2 100644 (file)
@@ -206,7 +206,7 @@ private:
       if (!reader_running)
        return;
       cond.Signal();
-      reader_thread.kill(SIGUSR1);
+      reader_thread.kill(SIGUSR2);
       lock.Unlock();
       reader_thread.join();
       lock.Lock();