diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2016-04-18 16:09:21 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2016-04-18 16:09:21 +0000 |
commit | 430309f13a89cb48bbff0d51768c88e8022b127b (patch) | |
tree | 3df947b30419cd12c412b3ec72bfc25ade714c40 /lldb/packages/Python/lldbsuite/test/result_formatter.py | |
parent | ec4f40b6ee8852dd0cb48b3deb621121066d590f (diff) | |
download | bcm5719-llvm-430309f13a89cb48bbff0d51768c88e8022b127b.tar.gz bcm5719-llvm-430309f13a89cb48bbff0d51768c88e8022b127b.zip |
fix a race is the LLDB test suite results collection
The race boiled down to this:
If a test worker queue is able to run the test inferior and
clean up before the dosep.py listener socket is spun up, and
the worker queue is the last one (as would be the case when
there's only one test rerunning in the rerun queue), then
the test suite will exit the main loop before having a chance
to process any test events coming from the test inferior or
the worker queue job control.
I found this race to be far more likely on fast hardware.
Our Linux CI is one such example. While it will show
up primarily during meta test events generated by
a worker thread when a test inferior times out or
exits with an exceptional exit (e.g. seg fault), it only
requires that the OS takes longer to hook up the
listener socket than it takes for the final test inferior
and worker thread to shut down.
See:
http://reviews.llvm.org/D19214
reviewed by:
Pavel Labath
llvm-svn: 266624
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/result_formatter.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/result_formatter.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/result_formatter.py b/lldb/packages/Python/lldbsuite/test/result_formatter.py index 070fa6c1440..5a783178ddf 100644 --- a/lldb/packages/Python/lldbsuite/test/result_formatter.py +++ b/lldb/packages/Python/lldbsuite/test/result_formatter.py @@ -76,6 +76,18 @@ def create_results_formatter(config): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(("localhost", port)) + + # Wait for the ack from the listener side. + # This is needed to prevent a race condition + # in the main dosep.py processing loop: we + # can't allow a worker queue thread to die + # that has outstanding messages to a listener + # socket before the listener socket asyncore + # listener socket gets spun up; otherwise, + # we lose the test result info. + read_bytes = sock.recv(1) + # print("\n** socket creation: received ack: {}".format(ord(read_bytes[0])), file=sys.stderr) + return (sock, lambda: socket_closer(sock)) default_formatter_name = None |