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

[minion-cvs] Attempt to prevent a crash



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

Modified Files:
	MMTPServer.py ServerQueue.py 
Log Message:
Attempt to prevent a crash

Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- MMTPServer.py	28 May 2003 06:37:37 -0000	1.30
+++ MMTPServer.py	30 May 2003 04:58:42 -0000	1.31
@@ -447,7 +447,8 @@
             if self.__state is self.__connectFn:
                 warn("Couldn't connect to server %s", self.address)
             else:
-                warn("Unexpectedly closed connection to %s", self.address)
+                warn("Unexpectedly closed connection to %s; state is %s",
+                     self.address, self.__state)
             self.handleFail(retriable=1)
             self.__sock.close()
             self.__server.unregister(self)
@@ -456,9 +457,11 @@
                 warn("Unexpected error: %s. Closing connection to %s.",
                      e, self.address)
                 self.shutdown(err=1, retriable=1)
+                self.__handleAll() # Try another round of the loop.
             else:
                 warn("Error while shutting down: closing connection to %s",
                      self.address)
+                self.__sock.close()
                 self.__server.unregister(self)
                 self.handleFail(1)
         else:
@@ -481,6 +484,10 @@
         """Begin a shutdown on this connection"""
         if err:
             self.handleFail(retriable)
+            #self.__sock.close()
+            #self.__state = None
+            #return
+            
         self.__state = self.__shutdownFn
 
     def fileno(self):
@@ -872,6 +879,7 @@
                     continue
                 self.failCallback(msg,handle,retriable)
         self._messageList = self.handleList = []
+        self._curMessage = self._curHandle = None
 
         if self.finishedCallback is not None:
             self.finishedCallback()

Index: ServerQueue.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerQueue.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ServerQueue.py	28 May 2003 06:37:44 -0000	1.16
+++ ServerQueue.py	30 May 2003 04:58:42 -0000	1.17
@@ -522,7 +522,9 @@
             knownHandles = self.pending.keys() + self.sendable
             allHandles.sort()
             knownHandles.sort()
-            assert allHandles == knownHandles
+            if allHandles != knownHandles:
+                LOG.error("_repOK: %s != %s", allHandles, knownHandles)
+                assert allHandles == knownHandles
             dsHandles = self.deliveryState.keys()
             naHandles = self.nextAttempt.keys()
             dsHandles.sort()
@@ -703,7 +705,7 @@
                 # This should never happen
                 LOG.error_exc(sys.exc_info(),
                               "Handle %s was not pending", handle)
-                lastAttempt = 0
+                return
 
             if retriable:
                 # If we can retry the message, update the deliveryState