mirror of https://github.com/python/cpython
I think the test_logging failure on Solaris is timing related. We don't
want to wait forever if we don't receive the last message. But we also don't want the test to fail if we shutdown too quickly. I can't reliably reproduce this failure, so I'm kinda guessing this is the problem. We'll see if this band-aid helps.
This commit is contained in:
parent
10be2ea85d
commit
67dfb6f086
|
@ -98,13 +98,22 @@ class LogRecordSocketReceiver(ThreadingTCPServer):
|
||||||
self.abort = 0
|
self.abort = 0
|
||||||
self.timeout = 1
|
self.timeout = 1
|
||||||
|
|
||||||
|
def _wait_and_process_data(self):
|
||||||
|
rd, wr, ex = select.select([self.socket.fileno()], [], [],
|
||||||
|
self.timeout)
|
||||||
|
if rd:
|
||||||
|
self.handle_request()
|
||||||
|
|
||||||
def serve_until_stopped(self):
|
def serve_until_stopped(self):
|
||||||
while not self.abort:
|
while not self.abort:
|
||||||
rd, wr, ex = select.select([self.socket.fileno()],
|
self._wait_and_process_data()
|
||||||
[], [],
|
|
||||||
self.timeout)
|
# XXX(nnorwitz): Try to fix timing related test failures.
|
||||||
if rd:
|
# It's possible self.aborted was set before the final message
|
||||||
self.handle_request()
|
# was received. By calling _wait_and_process_data(),
|
||||||
|
# it gives us one last chance to read messages.
|
||||||
|
# The test generally only fails on Solaris.
|
||||||
|
self._wait_and_process_data()
|
||||||
#notify the main thread that we're about to exit
|
#notify the main thread that we're about to exit
|
||||||
socketDataProcessed.set()
|
socketDataProcessed.set()
|
||||||
# close the listen socket
|
# close the listen socket
|
||||||
|
|
Loading…
Reference in New Issue