Commit 3fd9a593 authored by dpranke@chromium.org's avatar dpranke@chromium.org
Browse files

2011-01-18 Dirk Pranke <dpranke@chromium.org>

        Reviewed by Mihai Parparita.

        Fix a small race condition that could cause the unit tests for
        new-run-webkit-tests to fail in a multithreaded environment.
        There was a small window in the code where one thread would
        check to see if a thread had raised an exception, do something,
        and then check to see if the thread was alive. If the other
        thread raised an exception and exited in between these two
        steps, the exception would be lost. Flipping the order of the
        two checks fixes the race, since we will now always check for an
        exception on the thread before exiting.

        https://bugs.webkit.org/show_bug.cgi?id=51579

        * Scripts/webkitpy/layout_tests/layout_package/message_broker.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7bb3de43
2011-01-18 Dirk Pranke <dpranke@chromium.org>
Reviewed by Mihai Parparita.
Fix a small race condition that could cause the unit tests for
new-run-webkit-tests to fail in a multithreaded environment.
There was a small window in the code where one thread would
check to see if a thread had raised an exception, do something,
and then check to see if the thread was alive. If the other
thread raised an exception and exited in between these two
steps, the exception would be lost. Flipping the order of the
two checks fixes the race, since we will now always check for an
exception on the thread before exiting.
https://bugs.webkit.org/show_bug.cgi?id=51579
* Scripts/webkitpy/layout_tests/layout_package/message_broker.py:
2011-01-18 Eric Seidel <eric@webkit.org>
 
Reviewed by Adam Barth.
......@@ -144,6 +144,13 @@ class MultiThreadedBroker(WorkerMessageBroker):
some_thread_is_alive = False
t = time.time()
for thread in threads:
if thread.isAlive():
some_thread_is_alive = True
next_timeout = thread.next_timeout()
if next_timeout and t > next_timeout:
log_wedged_worker(thread.getName(), thread.id())
thread.clear_next_timeout()
exception_info = thread.exception_info()
if exception_info is not None:
# Re-raise the thread's exception here to make it
......@@ -152,13 +159,6 @@ class MultiThreadedBroker(WorkerMessageBroker):
# to have passed.
raise exception_info[0], exception_info[1], exception_info[2]
if thread.isAlive():
some_thread_is_alive = True
next_timeout = thread.next_timeout()
if next_timeout and t > next_timeout:
log_wedged_worker(thread.getName(), thread.id())
thread.clear_next_timeout()
self._test_runner.update()
if some_thread_is_alive:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment