diff options
author | Nathan Harmata <nharmata@google.com> | 2015-09-15 20:55:53 +0000 |
---|---|---|
committer | Florian Weikert <fwe@google.com> | 2015-09-16 10:17:41 +0000 |
commit | 38614b4f3c53734c78fb5b5830abb94c9daa791f (patch) | |
tree | 459ebf46543fd34033b5d6cfbddc0c0f9bf4c633 /src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java | |
parent | ac023bbcb127884e2c14c5c70848c61f149dfbbe (diff) |
Fix very minor concurrency issue in AQV. 'unhandled' doesn't have memory visibility from other threads, so we may end up storing the non-first unhandled exception and/or decline to not run new tasks because we don't realize there already is an unhandled exception.
--
MOS_MIGRATED_REVID=103127733
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java b/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java index c7ba0f7508..fe96b61be2 100644 --- a/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java +++ b/src/main/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitor.java @@ -121,7 +121,7 @@ public class AbstractQueueVisitor { * important to save the first one as it may be more informative than a * subsequent one, and this is not a performance-critical path. */ - private Throwable unhandled = null; + private volatile Throwable unhandled = null; /** * An uncaught exception when submitting a job to the ThreadPool is catastrophic, and usually @@ -186,7 +186,9 @@ public class AbstractQueueVisitor { private final boolean ownThreadPool; /** - * Flag used to record when all threads were killed by failed action execution + * Flag used to record when all threads were killed by failed action execution. + * + * <p>May only be accessed in a synchronized block. */ private boolean jobsMustBeStopped = false; |