[Python-checkins] cpython: Issue #12151: Added diagnostics to help diagnose intermittent socket errors.

vinay.sajip python-checkins at python.org
Mon May 23 22:38:04 CEST 2011


http://hg.python.org/cpython/rev/7980838e2f55
changeset:   70307:7980838e2f55
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Mon May 23 21:37:54 2011 +0100
summary:
  Issue #12151: Added diagnostics to help diagnose intermittent socket errors.

files:
  Lib/test/test_logging.py |  15 +++++++++++++++
  1 files changed, 15 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -893,14 +893,29 @@
 
                 def handle(self):
                     self.server._handler(self)
+
+                def finish(self):
+                    data = self.wfile.getvalue()
+                    try:
+                        super(DelegatingUDPRequestHandler, self).finish()
+                    except socket.error:
+                        msg = ('Error during finish, while sending %r, '
+                               'closed = %s')
+                        print(msg % (data, self._closed), file=sys.stderr)
+                        raise
+
             ThreadingUDPServer.__init__(self, addr, DelegatingUDPRequestHandler,
                                         bind_and_activate)
             ControlMixin.__init__(self, handler, poll_interval)
+            self._closed = False
 
         def server_bind(self):
             super(TestUDPServer, self).server_bind()
             self.port = self.socket.getsockname()[1]
 
+        def server_close(self):
+            super(TestUDPServer, self).server_close()
+            self._closed = True
 
 # - end of server_helper section
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list