More consistent error messaging on result iteration timeouts. CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/5c8e124b Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/5c8e124b Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/5c8e124b Branch: refs/heads/TINKERPOP-1565 Commit: 5c8e124bd0415d836e70fa16e5695ce76ab237b2 Parents: ed63426 Author: Stephen Mallette <sp...@genoprime.com> Authored: Mon Jan 16 09:48:28 2017 -0500 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Mon Jan 16 09:48:28 2017 -0500 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../gremlin/server/op/AbstractEvalOpProcessor.java | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c8e124b/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 4ca45c6..c5e4471 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Make error messaging more consistent during result iteration timeouts in Gremlin Server. * `PathRetractionStrategy` does not add a `NoOpBarrierStep` to the end of local children as its wasted computation in 99% of traversals. * Fixed a bug in `AddVertexStartStep` where if a side-effect was being used in the parametrization, an NPE occurred. * Fixed a bug in `LazyBarrierStrategy` where `profile()` was deactivating it accidentally. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c8e124b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java ---------------------------------------------------------------------- diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java index d5fe62a..48de830 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java @@ -247,15 +247,18 @@ public abstract class AbstractEvalOpProcessor extends AbstractOpProcessor { try { handleIterator(context, itty); } catch (TimeoutException ex) { + // a timeout occurs if serializedResponseTimeout is exceeded, but that setting is deprecated + // and by default disabled. we can remove this handling once we drop that setting all together final String errorMessage = String.format("Response iteration exceeded the configured threshold for request [%s] - %s", msg, ex.getMessage()); logger.warn(errorMessage); ctx.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR_TIMEOUT).statusMessage(errorMessage).create()); if (managedTransactionsForRequest) attemptRollback(msg, context.getGraphManager(), settings.strictTransactionManagement); } catch (InterruptedException ex) { - logger.warn(String.format("Interruption during result iteration on request [%s].", msg), ex); - final String exceptionMsg = ex.getMessage(); - final String err = "Interruption of result iteration" + (null == exceptionMsg || exceptionMsg.isEmpty() ? "" : " - " + exceptionMsg); - ctx.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR).statusMessage(err).create()); + // interruption occurs if there is a forced timeout during result iteration. this timeout + // is driven by the script evaluation timeout so for consistency the message should be the same + final String errorMessage = String.format("Script evaluation exceeded the configured threshold for request [%s] - %s", msg, ex.getMessage()); + logger.warn(errorMessage, ex); + ctx.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR_TIMEOUT).statusMessage(ex.getMessage()).create()); if (managedTransactionsForRequest) attemptRollback(msg, context.getGraphManager(), settings.strictTransactionManagement); } catch (Exception ex) { logger.warn(String.format("Exception processing a script on request [%s].", msg), ex); @@ -285,7 +288,7 @@ public abstract class AbstractEvalOpProcessor extends AbstractOpProcessor { logger.warn(errorMessage); ctx.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR_TIMEOUT).statusMessage("Timeout during script evaluation triggered by TimedInterruptCustomizerProvider").create()); } else if (t instanceof TimeoutException) { - final String errorMessage = String.format("Response evaluation exceeded the configured threshold for request [%s] - %s", msg, t.getMessage()); + final String errorMessage = String.format("Script evaluation exceeded the configured threshold for request [%s] - %s", msg, t.getMessage()); logger.warn(errorMessage, t); ctx.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR_TIMEOUT).statusMessage(t.getMessage()).create()); } else {