diff options
author | Andrew Or <andrewor14@gmail.com> | 2014-04-24 20:18:15 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-04-24 20:18:44 -0700 |
commit | 963046cf1bc093a377af39e07bc75afe1b64ade6 (patch) | |
tree | 80c6f5ba4b03aa224f3a83fa46b6ab9ec168347a /bin | |
parent | 0bc0f36d6be265d8ad5b1909fc06f03a661454a5 (diff) | |
download | spark-963046cf1bc093a377af39e07bc75afe1b64ade6.tar.gz spark-963046cf1bc093a377af39e07bc75afe1b64ade6.tar.bz2 spark-963046cf1bc093a377af39e07bc75afe1b64ade6.zip |
[SPARK-1615] Synchronize accesses to the LiveListenerBus' event queue
Original poster is @zsxwing, who reported this bug in #516.
Much of SparkListenerSuite relies on LiveListenerBus's `waitUntilEmpty()` method. As the name suggests, this waits until the event queue is empty. However, the following race condition could happen:
(1) We dequeue an event
(2) The queue is empty, we return true (even though the event has not been processed)
(3) The test asserts something assuming that all listeners have finished executing (and fails)
(4) The listeners receive and process the event
This PR makes (1) and (4) atomic by synchronizing around it. To do that, however, we must avoid using `eventQueue.take`, which is blocking and will cause a deadlock if we synchronize around it. As a workaround, we use the non-blocking `eventQueue.poll` + a semaphore to provide the same semantics.
This has been a possible race condition for a long time, but for some reason we've never run into it.
Author: Andrew Or <andrewor14@gmail.com>
Closes #544 from andrewor14/stage-info-test-fix and squashes the following commits:
3cbe40c [Andrew Or] Merge github.com:apache/spark into stage-info-test-fix
56dbbcb [Andrew Or] Check if event is actually added before releasing semaphore
eb486ae [Andrew Or] Synchronize accesses to the LiveListenerBus' event queue
(cherry picked from commit ee6f7e22a449837864072e3cd2b6696005f134f1)
Signed-off-by: Patrick Wendell <pwendell@gmail.com>
Diffstat (limited to 'bin')
0 files changed, 0 insertions, 0 deletions