You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/12/07 12:39:00 UTC

[jira] [Commented] (TINKERPOP-2106) When gremlin executes timeout, throw TimeoutException instead of TraversalInterruptedException/InterruptedIOException

    [ https://issues.apache.org/jira/browse/TINKERPOP-2106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16712791#comment-16712791 ] 

ASF GitHub Bot commented on TINKERPOP-2106:
-------------------------------------------

spmallette closed pull request #1009: TINKERPOP-2106 throw TimeoutException instead of TraversalInterruptedException
URL: https://github.com/apache/tinkerpop/pull/1009
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index fc171bbe28..45775f13c8 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -27,6 +27,7 @@
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineManager;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalInterruptedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,6 +36,8 @@
 import javax.script.CompiledScript;
 import javax.script.ScriptException;
 import javax.script.SimpleBindings;
+
+import java.io.InterruptedIOException;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Method;
 import java.util.Collection;
@@ -285,7 +288,9 @@ private GremlinExecutor(final Builder builder, final boolean suppliedExecutor,
 
                 // thread interruptions will typically come as the result of a timeout, so in those cases,
                 // check for that situation and convert to TimeoutException
-                if (root instanceof InterruptedException) {
+                if (root instanceof InterruptedException
+                        || root instanceof TraversalInterruptedException
+                        || root instanceof InterruptedIOException) {
                     lifeCycle.getAfterTimeout().orElse(afterTimeout).accept(bindings);
                     evaluationFuture.completeExceptionally(new TimeoutException(
                             String.format("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of %s ms or evaluation was otherwise cancelled directly for request [%s]: %s", scriptEvalTimeOut, script, root.getMessage())));


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> When gremlin executes timeout, throw TimeoutException instead of TraversalInterruptedException/InterruptedIOException
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2106
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2106
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: groovy
>    Affects Versions: 3.2.5
>            Reporter: Jermy Li
>            Priority: Major
>
> When gremlin executes timeout, it throws an error "TraversalInterruptedException: null". According to our user feedback, the message is not easy to understand. we think it is clearer if it prompts timeout error directly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)