diff options
author | 2016-12-16 22:00:48 +0000 | |
---|---|---|
committer | 2016-12-16 22:50:57 +0000 | |
commit | 79e496575bf665e4436b242b890590ddfc2f549b (patch) | |
tree | 8f34cc2163ff7542d16319d813b1e178951c3d2c /src | |
parent | e4cf9aa8b63173326cfe72ba76be4303bc038def (diff) |
Add some logging when query evaluation halts abruptly.
--
PiperOrigin-RevId: 142295816
MOS_MIGRATED_REVID=142295816
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java index 9a52eba825..d37367da67 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java @@ -18,6 +18,7 @@ import com.google.common.base.Ascii; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.base.Predicates; +import com.google.common.base.Throwables; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; @@ -106,6 +107,7 @@ import java.util.Queue; import java.util.Set; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nullable; @@ -332,20 +334,24 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> protected void evalTopLevelInternal( QueryExpression expr, OutputFormatterCallback<Target> callback) throws QueryException, InterruptedException { - boolean poolNeedsShutdown = true; + Throwable throwableToThrow = null; try { super.evalTopLevelInternal(expr, callback); - poolNeedsShutdown = false; + } catch (Throwable throwable) { + throwableToThrow = throwable; } finally { - if (poolNeedsShutdown) { + if (throwableToThrow != null) { + LOG.log(Level.INFO, "About to shutdown FJP because of throwable", throwableToThrow); // Force termination of remaining tasks if evaluation failed abruptly (e.g. was // interrupted). We don't want to leave any dangling threads running tasks. forkJoinPool.shutdownNow(); } forkJoinPool.awaitQuiescence(Long.MAX_VALUE, TimeUnit.MILLISECONDS); - if (poolNeedsShutdown) { + if (throwableToThrow != null) { // Signal that pool must be recreated on the next invocation. forkJoinPool = null; + Throwables.propagateIfPossible( + throwableToThrow, QueryException.class, InterruptedException.class); } } } |