Conflict resolved on previous merge.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b11dc474 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b11dc474 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b11dc474 Branch: refs/heads/master Commit: b11dc474ef8d72e6c0cc6c6ccbd5bcb06b2920b9 Parents: a8c36eb Author: Stephen Mallette <[email protected]> Authored: Fri Jul 8 14:59:24 2016 -0400 Committer: Stephen Mallette <[email protected]> Committed: Fri Jul 8 14:59:24 2016 -0400 ---------------------------------------------------------------------- .../tinkerpop/gremlin/server/op/AbstractOpProcessor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b11dc474/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java ---------------------------------------------------------------------- diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java index c3bad03..29861f2 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java @@ -109,7 +109,15 @@ public abstract class AbstractOpProcessor implements OpProcessor { // so iterating next() if the message is not written and flushed would bump the aggregate size beyond // the expected resultIterationBatchSize. Total serialization time for the response remains in // effect so if the client is "slow" it may simply timeout. - if (aggregate.size() < resultIterationBatchSize) aggregate.add(itty.next()); + // + // there is a need to check hasNext() on the iterator because if the channel is not writeable the + // previous pass through the while loop will have next()'d the iterator and if it is "done" then a + // NoSuchElementException will raise its head. + // + // this could be placed inside the isWriteable() portion of the if-then below but it seems better to + // allow iteration to continue into a batch if that is possible rather than just doing nothing at all + // while waiting for the client to catch up + if (aggregate.size() < resultIterationBatchSize && itty.hasNext()) aggregate.add(itty.next()); // send back a page of results if batch size is met or if it's the end of the results being iterated. // also check writeability of the channel to prevent OOME for slow clients.
