[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Backport zombieproofing to maintenance branch



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv24005/lib/mixminion/server

Modified Files:
      Tag: mixminion-v0-0-3-patches
	ServerMain.py 
Log Message:
Backport zombieproofing to maintenance branch

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.44
retrieving revision 1.44.2.1
diff -u -d -r1.44 -r1.44.2.1
--- ServerMain.py	20 Feb 2003 16:57:40 -0000	1.44
+++ ServerMain.py	22 Apr 2003 02:08:00 -0000	1.44.2.1
@@ -495,6 +495,7 @@
         now = time.time()
 
         scheduledEvents.append( (now + 600, "SHRED") )#FFFF make configurable
+        scheduledEvents.append( (now + 180, "WAIT") )#FFFF make configurable
         scheduledEvents.append( (self.mmtpServer.getNextTimeoutTime(now),
                                  "TIMEOUT") )
         nextMix = self.mixPool.getNextMixTime(now)
@@ -550,6 +551,15 @@
             elif event == 'SHRED':
                 self.cleanQueues()
                 insort(scheduledEvents, (now + 600, "SHRED"))
+            elif event == 'WAIT':
+                # Every few minutes, we reap zombies.  Why, you ask?  Isn't
+                # catching sigchild enough?  Nope -- sometimes buggy delivery
+                # software forks, stays along long enough to ignore a child's
+                # sigchild, then dies itself.  Or something -- in any case, we
+                # sure seem to be leaving a bunch of zombie mixmaster processes
+                # around.  This should fix it.
+                waitForChildren(blocking=0)
+                insort(scheduledEvents, (now + 180, "WAIT"))
             elif event == 'MIX':
                 # Before we mix, we need to log the hashes to avoid replays.
                 try:
@@ -576,7 +586,7 @@
                 insort(scheduledEvents, (nextMix, "MIX"))
                 LOG.trace("Next mix at %s", formatTime(nextMix,1))
             else:
-                assert event in ("MIX", "SHRED", "TIMEOUT")
+                assert event in ("MIX", "SHRED", "TIMEOUT", "WAIT")
 
     def cleanQueues(self):
         """Remove all deleted messages from queues"""