Commits

Simon Cross committed d644380

(simon, fijal) Harden processExited against exceptions to avoid Twisted bug #5151 which can break Twisted's process state and lead to many unrelated test failures if triggered. Fix related miss-calling of loseConnection too.

Comments (0)

Files changed (2)

katcp/tx/proxy.py

             if device.state != device.UNSYNCED:
                 device.stopping = True
                 device.stop()
-                device.transport.loseConnection(None)
+                device.transport.loseConnection()
         DeviceServer.stop(self)
 
     def unregister_device(self, dev_name):

katcp/tx/test/testserver.py

 from twisted.internet import reactor
 from twisted.internet.defer import Deferred
 from twisted.internet.error import ProcessDone
+from twisted.python import log
 
 class FloatSensor(Sensor):
     def get_value(self):
             print "RECEIVED: " + data
 
     def processExited(self, status):
-        self.server_ended(status)
+        try:
+            self.server_ended(status)
+        except Exception:
+            # raising exceptions from processExited triggers Twisted bug #5151
+            # so log the exception instead
+            log.err()
 
 PORT = 0