run-tests: "fix" race condition in race condition fix stable
authorBryan O'Sullivan <bryano@fb.com>
Fri, 22 Jan 2016 11:00:13 -0800
branchstable
changeset 27933 a6833e464b07
parent 27932 6bc2299cc12f
child 27934 1779ff7426c9
run-tests: "fix" race condition in race condition fix Laurent's commit 3203dfe341f9 still suffers from a race: by the time the "job" function tries to assign to channels[channel], that list has been truncated to empty. The result is that every job thread raises an IndexError. Earlier, I tried an approach of correctly locking channels, but that caused run-tests to hang on KeyboardInterrupt sometimes. This approach is strictly hackier, but seems to actually work reliably.
tests/run-tests.py
--- a/tests/run-tests.py	Fri Jan 22 20:32:47 2016 +0000
+++ b/tests/run-tests.py	Fri Jan 22 11:00:13 2016 -0800
@@ -1526,13 +1526,16 @@
             channels[channel] = "=" + test.name[5:].split(".")[0]
             try:
                 test(result)
-                channels[channel] = ''
                 done.put(None)
             except KeyboardInterrupt:
-                channels[channel] = ''
+                pass
             except: # re-raises
                 done.put(('!', test, 'run-test raised an error, see traceback'))
                 raise
+            try:
+                channels[channel] = ''
+            except IndexError:
+                pass
 
         def stat():
             count = 0