diff options
author | Klaus Aehlig <aehlig@google.com> | 2016-07-08 13:30:18 +0000 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2016-07-08 13:40:20 +0000 |
commit | 916b23cd68caba94a8e3d0c5af026a750a42a626 (patch) | |
tree | baada48164f2653d0d31cb1cf20d5eff815e8faf /src/main/java/com/google/devtools/build | |
parent | 949c876fadae5a23635756265447082b9cdf44c7 (diff) |
ExperimentalEventHandler: remove deadlock in update thread
When the progress bar has to be updated, but we cannot do so immediately, e.g.,
due to rate limiting, we start a thread to do this eventually (the "update
thread"). That thread gets stopped if either we realize during an update of the
progress bar that it is no longer needed, or if we get informed about the
completion of the build. Now, since the update thread does updates of the
progress bar (that is its whole purpose) it can get the duty to stop itself.
To avoid the deadlock when the thread there blockingly waits for itself
to terminate, just skip that termination and let the update thread run
till the end of the build.
--
Change-Id: Iba08806f5e416f1fa1825969eceaf6cf54c24e6c
Reviewed-on: https://bazel-review.googlesource.com/#/c/4010
MOS_MIGRATED_REVID=126906395
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java index ee9028139a..fb0822acc7 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java @@ -417,6 +417,9 @@ public class ExperimentalEventHandler implements EventHandler { } private void doRefresh() { + if (buildComplete) { + return; + } long nowMillis = clock.currentTimeMillis(); if (lastRefreshMillis + minimalDelayMillis < nowMillis) { synchronized (this) { @@ -431,9 +434,6 @@ public class ExperimentalEventHandler implements EventHandler { LOG.warning("IO Error writing to output stream: " + e); } } - if (!stateTracker.progressBarTimeDependent() && mustRefreshAfterMillis < lastRefreshMillis) { - stopUpdateThread(); - } } else { // We skipped an update due to rate limiting. If this however, turned // out to be the last update for a long while, we need to show it in a |