You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2021/12/29 22:14:33 UTC

[tinkerpop] branch master updated (db8eb63 -> 366d5e4)

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.


    from db8eb63  Merge branch '3.5-dev'
     new e0412a6  Reduced resources consumed by gremlin server integration tests
     new 84cfe8f  Merge branch '3.4-dev' into 3.5-dev
     new 366d5e4  Merge branch '3.5-dev'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 gremlin-server/conf/neo4j-empty.properties         |  6 ++
 .../tinkerpop/gremlin/server/GremlinServer.java    | 35 ++++++++-
 .../driver/remote/AbstractRemoteGraphProvider.java |  6 ++
 .../AbstractGremlinServerIntegrationTest.java      | 25 ++++++-
 .../gremlin/server/GremlinDriverIntegrateTest.java | 85 +++++++++++-----------
 .../server/GremlinServerHttpIntegrateTest.java     |  6 +-
 .../gremlin/server/GremlinServerIntegrateTest.java | 22 +++++-
 .../server/GremlinServerSessionIntegrateTest.java  | 24 ++----
 8 files changed, 137 insertions(+), 72 deletions(-)

[tinkerpop] 01/03: Reduced resources consumed by gremlin server integration tests

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit e0412a67ed65218a6e0ff8c7d9ca10475f0ec362
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Tue Dec 28 18:30:17 2021 -0500

    Reduced resources consumed by gremlin server integration tests
    
    Prevented neo4j configuration if neo4j not enabled in build helping stop errors in the log. Close Cluster instances after tests. Not doing so seems to leak connection pools which not only consumes memory but floods the logs with fake failures. Reduced the memory footprint of neo4j for testing by modifying its default configurations. Added some changes to help try to release resources held by Gremlin Server. Specifically, called close() on GraphTraversalSource instances in the GraphMan [...]
---
 gremlin-server/conf/neo4j-empty.properties         |  6 ++
 .../tinkerpop/gremlin/server/GremlinServer.java    | 35 ++++++++-
 .../driver/remote/AbstractRemoteGraphProvider.java |  6 ++
 .../AbstractGremlinServerIntegrationTest.java      | 25 +++++-
 .../gremlin/server/GremlinDriverIntegrateTest.java | 89 +++++++++++-----------
 .../server/GremlinServerHttpIntegrateTest.java     |  6 +-
 .../gremlin/server/GremlinServerIntegrateTest.java | 35 +++++++--
 .../server/GremlinServerSessionIntegrateTest.java  | 15 +---
 8 files changed, 145 insertions(+), 72 deletions(-)

diff --git a/gremlin-server/conf/neo4j-empty.properties b/gremlin-server/conf/neo4j-empty.properties
index d1ad61e..f20aa30 100644
--- a/gremlin-server/conf/neo4j-empty.properties
+++ b/gremlin-server/conf/neo4j-empty.properties
@@ -34,6 +34,12 @@ gremlin.neo4j.conf.dbms.auto_index.nodes.enabled=true
 gremlin.neo4j.conf.dbms.auto_index.relationships.enabled=true
 #gremlin.neo4j.conf.dbms.auto_index.relationships.keys=
 
+# these memory settings are likely unsuitable for production cases
+gremlin.neo4j.conf.dbms.memory.heap.initial_size=500m
+gremlin.neo4j.conf.dbms.memory.heap.max_size=500m
+gremlin.neo4j.conf.dbms.memory.pagecache.size=1m
+gremlin.neo4j.conf.dbms.tx_state.memory_allocation=ON_HEAP
+
 # uncomment the following to enable Bolt on the specified port
 # gremlin.neo4j.conf.dbms.connector.0.type=BOLT
 # gremlin.neo4j.conf.dbms.connector.0.enabled=true
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
index 2a1adf7..1e16ea1 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
@@ -39,12 +39,15 @@ import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook;
 import org.apache.tinkerpop.gremlin.server.util.MetricManager;
 import org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor;
 import org.apache.tinkerpop.gremlin.server.util.ThreadFactoryUtil;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.apache.tinkerpop.gremlin.util.Gremlin;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Set;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
@@ -296,16 +299,44 @@ public class GremlinServer {
                 logger.warn("Timeout waiting for boss/worker thread pools to shutdown - continuing with shutdown process.");
             }
 
+            // close TraversalSource and Graph instances - there aren't guarantees that closing Graph will close all
+            // spawned TraversalSource instances so both should be closed directly and independently.
             if (serverGremlinExecutor != null) {
-                serverGremlinExecutor.getGraphManager().getGraphNames().forEach(gName -> {
+                final Set<String> traversalSourceNames = serverGremlinExecutor.getGraphManager().getTraversalSourceNames();
+                traversalSourceNames.forEach(traversalSourceName -> {
+                    logger.debug("Closing GraphTraversalSource instance [{}]", traversalSourceName);
+                    try {
+                        serverGremlinExecutor.getGraphManager().getTraversalSource(traversalSourceName).close();
+                    } catch (Exception ex) {
+                        logger.warn(String.format("Exception while closing GraphTraversalSource instance [%s]", traversalSourceName), ex);
+                    } finally {
+                        logger.info("Closed GraphTraversalSource instance [{}]", traversalSourceName);
+                    }
+
+                    try {
+                        serverGremlinExecutor.getGraphManager().removeTraversalSource(traversalSourceName);
+                    } catch (Exception ex) {
+                        logger.warn(String.format("Exception while removing GraphTraversalSource instance [%s] from GraphManager", traversalSourceName), ex);
+                    }
+                });
+
+                final Set<String> graphNames = serverGremlinExecutor.getGraphManager().getGraphNames();
+                graphNames.forEach(gName -> {
                     logger.debug("Closing Graph instance [{}]", gName);
                     try {
-                        serverGremlinExecutor.getGraphManager().getGraph(gName).close();
+                        final Graph graph = serverGremlinExecutor.getGraphManager().getGraph(gName);
+                        graph.close();
                     } catch (Exception ex) {
                         logger.warn(String.format("Exception while closing Graph instance [%s]", gName), ex);
                     } finally {
                         logger.info("Closed Graph instance [{}]", gName);
                     }
+
+                    try {
+                        serverGremlinExecutor.getGraphManager().removeGraph(gName);
+                    } catch (Exception ex) {
+                        logger.warn(String.format("Exception while removing Graph instance [%s] from GraphManager", gName), ex);
+                    }
                 });
             }
 
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/AbstractRemoteGraphProvider.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/AbstractRemoteGraphProvider.java
index e86a546..696669f 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/AbstractRemoteGraphProvider.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/AbstractRemoteGraphProvider.java
@@ -237,6 +237,12 @@ public abstract class AbstractRemoteGraphProvider extends AbstractGraphProvider
     @Override
     public void close() throws Exception {
         try {
+            cluster.close();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+
+        try {
             stopServer();
         } catch (Exception ex) {
             throw new RuntimeException(ex);
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
index 634063e..c394531 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.server;
 
 import org.apache.tinkerpop.gremlin.server.op.OpLoader;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -130,9 +131,15 @@ public abstract class AbstractGremlinServerIntegrationTest {
     }
 
     public void stopServer() throws Exception {
+        // calling close() on TinkerGraph does not free resources quickly enough. adding a clear() call let's gc
+        // cleanup earlier
+        server.getServerGremlinExecutor().getGraphManager().getAsBindings().values().stream()
+                .filter(g -> g instanceof TinkerGraph).forEach(g -> ((TinkerGraph) g).clear());
+
         if (server != null) {
             server.stop().join();
         }
+
         // reset the OpLoader processors so that they can get reconfigured on startup - Settings may have changed
         // between tests
         OpLoader.reset();
@@ -155,14 +162,24 @@ public abstract class AbstractGremlinServerIntegrationTest {
         return (directory.delete());
     }
 
-    protected static void assumeNeo4jIsPresent() {
-        boolean neo4jIncludedForTesting;
+    protected static void tryIncludeNeo4jGraph(final Settings settings) {
+        if (isNeo4jPresent()) {
+            deleteDirectory(new File("/tmp/neo4j"));
+            settings.graphs.put("graph", "conf/neo4j-empty.properties");
+        }
+    }
+
+    protected static boolean isNeo4jPresent() {
         try {
             Class.forName("org.neo4j.tinkerpop.api.impl.Neo4jGraphAPIImpl");
-            neo4jIncludedForTesting = true;
+            return true;
         } catch (Exception ex) {
-            neo4jIncludedForTesting = false;
+            return false;
         }
+    }
+
+    protected static void assumeNeo4jIsPresent() {
+        boolean neo4jIncludedForTesting = isNeo4jPresent();
         assumeThat("Neo4j implementation was not included for testing - run with -DincludeNeo4j", neo4jIncludedForTesting, is(true));
     }
 }
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index 2eb6aa7..15b3004 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@ -185,16 +185,14 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
             case "shouldExecuteScriptInSessionOnTransactionalWithManualTransactionsGraph":
             case "shouldExecuteInSessionAndSessionlessWithoutOpeningTransaction":
             case "shouldManageTransactionsInSession":
-                deleteDirectory(new File("/tmp/neo4j"));
-                settings.graphs.put("graph", "conf/neo4j-empty.properties");
+                tryIncludeNeo4jGraph(settings);
                 break;
             case "shouldRequireAliasedGraphVariablesInStrictTransactionMode":
                 settings.strictTransactionManagement = true;
                 break;
             case "shouldAliasGraphVariablesInStrictTransactionMode":
                 settings.strictTransactionManagement = true;
-                deleteDirectory(new File("/tmp/neo4j"));
-                settings.graphs.put("graph", "conf/neo4j-empty.properties");
+                tryIncludeNeo4jGraph(settings);
                 break;
             case "shouldProcessSessionRequestsInOrderAfterTimeout":
                 settings.evaluationTimeout = 250;
@@ -671,6 +669,8 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
             assertThat("Should contain 2 results", results.size() == 2);
             assertThat("The numeric result should be 1", results.contains(1L));
             assertThat("The string result contain label person", results.contains("person"));
+
+            executor.shutdown();
         } finally {
             cluster.close();
         }
@@ -1022,7 +1022,6 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
         final Client client = cluster.connect();
 
         try {
-
             final List<Result> r = client.submit("TinkerFactory.createModern().traversal().V(1)").all().join();
             assertEquals(1, r.size());
 
@@ -1502,9 +1501,9 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
             assertThat(root, instanceOf(ResponseException.class));
             final ResponseException re = (ResponseException) root;
             assertEquals(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS, re.getResponseStatusCode());
+        } finally {
+            cluster.close();
         }
-
-        cluster.close();
     }
 
     @Test
@@ -1522,13 +1521,13 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
             assertThat(root, instanceOf(ResponseException.class));
             final ResponseException re = (ResponseException) root;
             assertEquals(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS, re.getResponseStatusCode());
-        }
-
-        final Client rebound = cluster.connect().alias("graph");
-        final Vertex v = rebound.submit("g.addVertex('name','jason')").all().get().get(0).getVertex();
-        assertEquals("jason", v.value("name"));
 
-        cluster.close();
+            final Client rebound = cluster.connect().alias("graph");
+            final Vertex v = rebound.submit("g.addVertex('name','jason')").all().get().get(0).getVertex();
+            assertEquals("jason", v.value("name"));
+        } finally {
+            cluster.close();
+        }
     }
 
     @Test
@@ -1544,13 +1543,13 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
             assertThat(root, instanceOf(ResponseException.class));
             final ResponseException re = (ResponseException) root;
             assertEquals(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION, re.getResponseStatusCode());
-        }
-
-        final Client rebound = cluster.connect().alias("graph");
-        final Vertex v = rebound.submit("g.addVertex('name','jason')").all().get().get(0).getVertex();
-        assertEquals("jason", v.value("name"));
 
-        cluster.close();
+            final Client rebound = cluster.connect().alias("graph");
+            final Vertex v = rebound.submit("g.addVertex('name','jason')").all().get().get(0).getVertex();
+            assertEquals("jason", v.value("name"));
+        } finally {
+            cluster.close();
+        }
     }
 
     @Test
@@ -1786,6 +1785,7 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
         final Client client = Mockito.spy(cluster.connect().alias("g"));
         client.submit("", RequestOptions.build().userAgent("test").create()).all().get();
         cluster.close();
+
         final ArgumentCaptor<RequestMessage> requestMessageCaptor = ArgumentCaptor.forClass(RequestMessage.class);
         verify(client).submitAsync(requestMessageCaptor.capture());
         final RequestMessage requestMessage = requestMessageCaptor.getValue();
@@ -1800,14 +1800,15 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
         final GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(client));
         g.with(Tokens.ARGS_USER_AGENT, "test").V().iterate();
         cluster.close();
-        ArgumentCaptor<RequestOptions> requestOptionsCaptor = ArgumentCaptor.forClass(RequestOptions.class);
+
+        final ArgumentCaptor<RequestOptions> requestOptionsCaptor = ArgumentCaptor.forClass(RequestOptions.class);
         verify(client).submitAsync(Mockito.any(Bytecode.class), requestOptionsCaptor.capture());
-        RequestOptions requestOptions = requestOptionsCaptor.getValue();
+        final RequestOptions requestOptions = requestOptionsCaptor.getValue();
         assertEquals("test", requestOptions.getUserAgent().get());
 
-        ArgumentCaptor<RequestMessage> requestMessageCaptor = ArgumentCaptor.forClass(RequestMessage.class);
+        final ArgumentCaptor<RequestMessage> requestMessageCaptor = ArgumentCaptor.forClass(RequestMessage.class);
         verify(client).submitAsync(requestMessageCaptor.capture());
-        RequestMessage requestMessage = requestMessageCaptor.getValue();
+        final RequestMessage requestMessage = requestMessageCaptor.getValue();
         assertEquals("test", requestMessage.getArgs().getOrDefault(Tokens.ARGS_USER_AGENT, null));
     }
 
@@ -1815,32 +1816,29 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
     public void shouldSendRequestIdBytecode() {
         final UUID overrideRequestId = UUID.randomUUID();
         final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRAPHSON_V3D0).create();
-            final Client client = Mockito.spy(cluster.connect().alias("g"));
-            Mockito.when(client.alias("g")).thenReturn(client);
-            GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(client));
-            g.with(Tokens.REQUEST_ID, overrideRequestId).V().iterate();
-            cluster.close();
-            ArgumentCaptor<RequestOptions> requestOptionsCaptor = ArgumentCaptor.forClass(RequestOptions.class);
-            verify(client).submitAsync(Mockito.any(Bytecode.class), requestOptionsCaptor.capture());
-            RequestOptions requestOptions = requestOptionsCaptor.getValue();
-            assertTrue(requestOptions.getOverrideRequestId().isPresent());
-            assertEquals(overrideRequestId, requestOptions.getOverrideRequestId().get());
+        final Client client = Mockito.spy(cluster.connect().alias("g"));
+        Mockito.when(client.alias("g")).thenReturn(client);
+        final GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(client));
+        g.with(Tokens.REQUEST_ID, overrideRequestId).V().iterate();
+        cluster.close();
 
-            ArgumentCaptor<RequestMessage> requestMessageCaptor = ArgumentCaptor.forClass(RequestMessage.class);
-            verify(client).submitAsync(requestMessageCaptor.capture());
-            RequestMessage requestMessage = requestMessageCaptor.getValue();
-            assertEquals(overrideRequestId, requestMessage.getRequestId());
+        final ArgumentCaptor<RequestOptions> requestOptionsCaptor = ArgumentCaptor.forClass(RequestOptions.class);
+        verify(client).submitAsync(Mockito.any(Bytecode.class), requestOptionsCaptor.capture());
+        final RequestOptions requestOptions = requestOptionsCaptor.getValue();
+        assertTrue(requestOptions.getOverrideRequestId().isPresent());
+        assertEquals(overrideRequestId, requestOptions.getOverrideRequestId().get());
 
+        final ArgumentCaptor<RequestMessage> requestMessageCaptor = ArgumentCaptor.forClass(RequestMessage.class);
+        verify(client).submitAsync(requestMessageCaptor.capture());
+        final RequestMessage requestMessage = requestMessageCaptor.getValue();
+        assertEquals(overrideRequestId, requestMessage.getRequestId());
     }
 
     private void assertFutureTimeout(final CompletableFuture<List<Result>> futureFirst) {
-        try
-        {
+        try {
             futureFirst.get();
             fail("Should have timed out");
-        }
-        catch (Exception ex)
-        {
+        } catch (Exception ex) {
             final Throwable root = ExceptionUtils.getRootCause(ex);
             assertThat(root, instanceOf(ResponseException.class));
             assertThat(root.getMessage(), startsWith("Evaluation exceeded the configured 'evaluationTimeout' threshold of 250 ms"));
@@ -1873,9 +1871,10 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
             // should get a rejection here
             final Throwable root = ExceptionUtils.getRootCause(ex);
             assertThat(root.getMessage(), startsWith("There is already a request pending with an id of:"));
+            assertEquals(100, result1.get().one().getInt());
+        } finally {
+            cluster.close();
         }
-
-        assertEquals(100, result1.get().one().getInt());
     }
 
     /**
@@ -1895,7 +1894,7 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
             logger.info("Verifying driver cannot connect to server.");
             client.submit("g").all().get(500, TimeUnit.MILLISECONDS);
             fail("Should throw an exception.");
-        } catch (RuntimeException re) {
+        } catch (Exception re) {
             // Client would have no active connections to the host, hence it would encounter a timeout
             // trying to find an alive connection to the host.
             assertThat(re.getCause(), instanceOf(NoHostAvailableException.class));
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
index 8916ee9..9eefa76 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
@@ -73,13 +73,11 @@ public class GremlinServerHttpIntegrateTest extends AbstractGremlinServerIntegra
                 settings.maxContentLength = 31;
                 break;
             case "should200OnPOSTTransactionalGraph":
-                deleteDirectory(new File("/tmp/neo4j"));
-                settings.graphs.put("graph", "conf/neo4j-empty.properties");
+                tryIncludeNeo4jGraph(settings);
                 break;
             case "should200OnPOSTTransactionalGraphInStrictMode":
+                tryIncludeNeo4jGraph(settings);
                 settings.strictTransactionManagement = true;
-                deleteDirectory(new File("/tmp/neo4j"));
-                settings.graphs.put("graph", "conf/neo4j-empty.properties");
                 break;
             case "should200OnPOSTWithGraphSON1d0AcceptHeaderDefaultResultToJson":
                 settings.serializers.clear();
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index 8a63694..4a95ae3 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -267,6 +267,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             assertThat(t, instanceOf(ResponseException.class));
             assertEquals(ResponseStatusCode.SERVER_ERROR_TIMEOUT, ((ResponseException) t).getResponseStatusCode());
         }
+
+        g.close();
     }
 
     @Test
@@ -285,7 +287,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldPingChannelIfClientDies() throws Exception {
-        final Client client = TestClientFactory.build().maxConnectionPoolSize(1).minConnectionPoolSize(1).keepAliveInterval(0).create().connect();
+        final Cluster cluster = TestClientFactory.build().maxConnectionPoolSize(1).minConnectionPoolSize(1).keepAliveInterval(0).create();
+        final Client client = cluster.connect();
         client.submit("1+1").all().get();
 
         // since we do nothing for 3 seconds and the time limit for ping is 1 second we should get *about* 3 pings -
@@ -293,7 +296,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         // there record
         Thread.sleep(3000);
 
-        client.close();
+        cluster.close();
 
         // stop the server to be sure that logs flush
         stopServer();
@@ -327,6 +330,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             assertThat(t, instanceOf(ResponseException.class));
             assertEquals(ResponseStatusCode.SERVER_ERROR_TIMEOUT, ((ResponseException) t).getResponseStatusCode());
         }
+
+        g.close();
     }
 
     @Test
@@ -355,10 +360,12 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             assertThat(t, instanceOf(ResponseException.class));
             assertEquals(ResponseStatusCode.SERVER_ERROR_TIMEOUT, ((ResponseException) t).getResponseStatusCode());
         }
+
+        g.close();
     }
 
     @Test
-    public void shouldTimeOutRemoteTraversalWithPerRequestOption() {
+    public void shouldTimeOutRemoteTraversalWithPerRequestOption() throws Exception {
         final GraphTraversalSource g = traversal().withRemote(conf);
 
         try {
@@ -383,6 +390,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             assertThat(t, instanceOf(ResponseException.class));
             assertEquals(ResponseStatusCode.SERVER_ERROR_TIMEOUT, ((ResponseException) t).getResponseStatusCode());
         }
+
+        g.close();
     }
 
     @Test
@@ -980,6 +989,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
         assertEquals(50L, g.V().hasLabel("person").map(Lambda.function("it.get().value('age') + 10")).sum().next());
+        g.close();
     }
 
     @Test
@@ -1018,6 +1028,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         gdotv.toList();
         final DriverRemoteTraversalSideEffects gdotvSe = (DriverRemoteTraversalSideEffects) gdotv.asAdmin().getSideEffects();
         assertThat(gdotvSe.statusAttributes().containsKey(Tokens.ARGS_HOST), is(true));
+
+        g.close();
     }
 
     @Test
@@ -1068,6 +1080,9 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             error = true;
         }
         assertThat(error, is(true));
+
+        g.close();
+        cluster.close();
     }
 
     @Test
@@ -1083,7 +1098,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         traversal.hasNext();
 
         // start a separate thread to iterate
-        final Thread t = new Thread(traversal::iterate);
+        final Thread t = new Thread(traversal::iterate, name.getMethodName());
         t.start();
 
         // blocks here until traversal iteration is complete
@@ -1110,6 +1125,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
         final BulkSet localBSideEffects = se.get("b");
         assertThat(localBSideEffects.isEmpty(), is(false));
+
+        g.close();
     }
 
     @Test
@@ -1125,7 +1142,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         traversal.hasNext();
 
         // start a separate thread to iterate
-        final Thread t = new Thread(traversal::iterate);
+        final Thread t = new Thread(traversal::iterate, name.getMethodName());
         t.start();
 
         // blocks here until traversal iteration is complete
@@ -1152,6 +1169,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
         final BulkSet localBSideEffects = se.get("b");
         assertThat(localBSideEffects.isEmpty(), is(false));
+
+        g.close();
     }
 
     @Test
@@ -1163,7 +1182,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         g.addV("person").property("age", 20).promise(Traversal::iterate).join();
 
         final Traversal<Vertex,Integer> traversal = g.V().hasLabel("person").has("age", 20).values("age");
-        int age = traversal.promise(t -> t.next(1).get(0)).join();
+        final int age = traversal.promise(t -> t.next(1).get(0)).join();
         assertEquals(20, age);
         assertEquals(20, (int)traversal.next());
         assertThat(traversal.hasNext(), is(false));
@@ -1174,6 +1193,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         assertThat(traversalCloned.promise(t -> ((Traversal) t).hasNext()).join(), is(false));
 
         assertEquals(3, g.V().promise(Traversal::toList).join().size());
+
+        g.close();
     }
 
     @Test
@@ -1199,6 +1220,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             fail("Should have tanked out because of number of parameters used and size of the compile script");
         } catch (Exception ex) {
             assertThat(ex.getMessage(), containsString("The Gremlin statement that was submitted exceeds the maximum compilation size allowed by the JVM"));
+        } finally {
+            cluster.close();
         }
     }
 }
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index ddf39d3..5af4f60 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
@@ -103,7 +103,10 @@ public class GremlinServerSessionIntegrateTest extends AbstractGremlinServerInte
                 break;
             case "shouldBlockAdditionalRequestsDuringClose":
             case "shouldBlockAdditionalRequestsDuringForceClose":
-                clearNeo4j(settings);
+            case "shouldExecuteInSessionAndSessionlessWithoutOpeningTransactionWithSingleClient":
+            case "shouldExecuteInSessionWithTransactionManagement":
+            case "shouldRollbackOnEvalExceptionForManagedTransaction":
+                tryIncludeNeo4jGraph(settings);
                 break;
             case "shouldEnsureSessionBindingsAreThreadSafe":
                 settings.threadPoolWorker = 2;
@@ -116,21 +119,11 @@ public class GremlinServerSessionIntegrateTest extends AbstractGremlinServerInte
                 processorSettingsForDisableFunctionCache.config.put(SessionOpProcessor.CONFIG_GLOBAL_FUNCTION_CACHE_ENABLED, false);
                 settings.processors.add(processorSettingsForDisableFunctionCache);
                 break;
-            case "shouldExecuteInSessionAndSessionlessWithoutOpeningTransactionWithSingleClient":
-            case "shouldExecuteInSessionWithTransactionManagement":
-            case "shouldRollbackOnEvalExceptionForManagedTransaction":
-                clearNeo4j(settings);
-                break;
         }
 
         return settings;
     }
 
-    private static void clearNeo4j(Settings settings) {
-        deleteDirectory(new File("/tmp/neo4j"));
-        settings.graphs.put("graph", "conf/neo4j-empty.properties");
-    }
-
     @Test
     public void shouldUseGlobalFunctionCache() throws Exception {
         final Cluster cluster = TestClientFactory.open();

[tinkerpop] 03/03: Merge branch '3.5-dev'

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 366d5e4352463c0565a81bd90dbdf357ce3d6f77
Merge: db8eb63 84cfe8f
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Wed Dec 29 17:14:20 2021 -0500

    Merge branch '3.5-dev'

 gremlin-server/conf/neo4j-empty.properties         |  6 ++
 .../tinkerpop/gremlin/server/GremlinServer.java    | 35 ++++++++-
 .../driver/remote/AbstractRemoteGraphProvider.java |  6 ++
 .../AbstractGremlinServerIntegrationTest.java      | 25 ++++++-
 .../gremlin/server/GremlinDriverIntegrateTest.java | 85 +++++++++++-----------
 .../server/GremlinServerHttpIntegrateTest.java     |  6 +-
 .../gremlin/server/GremlinServerIntegrateTest.java | 22 +++++-
 .../server/GremlinServerSessionIntegrateTest.java  | 24 ++----
 8 files changed, 137 insertions(+), 72 deletions(-)

diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index dd9b682,fd12632..9ecc7d0
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@@ -1081,22 -1083,8 +1093,24 @@@ public class GremlinServerIntegrateTes
              assertThat(t, instanceOf(ResponseException.class));
              assertEquals("try again!", t.getMessage());
              assertEquals(ResponseStatusCode.SERVER_ERROR_TEMPORARY, ((ResponseException) t).getResponseStatusCode());
+         } finally {
+             cluster.close();
          }
      }
 +
 +    @Test
 +    public void shouldGenerateFailureErrorResponseStatusCode() throws Exception {
 +        final Cluster cluster = TestClientFactory.build().create();
 +        final Client client = cluster.connect();
 +
 +        try {
 +            client.submit("g.inject(0).fail('make it stop')").all().get();
 +            fail("Should have tanked since we used fail() step");
 +        } catch (Exception ex) {
 +            final Throwable t = ex.getCause();
 +            assertThat(t, instanceOf(ResponseException.class));
 +            assertEquals("make it stop", t.getMessage());
 +            assertEquals(ResponseStatusCode.SERVER_ERROR_FAIL_STEP, ((ResponseException) t).getResponseStatusCode());
 +        }
 +    }
  }

[tinkerpop] 02/03: Merge branch '3.4-dev' into 3.5-dev

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 84cfe8f00b5b4ecccc55d3cbdf06d95294e7c94f
Merge: 014ba55 e0412a6
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Wed Dec 29 17:14:11 2021 -0500

    Merge branch '3.4-dev' into 3.5-dev

 gremlin-server/conf/neo4j-empty.properties         |  6 ++
 .../tinkerpop/gremlin/server/GremlinServer.java    | 35 ++++++++-
 .../driver/remote/AbstractRemoteGraphProvider.java |  6 ++
 .../AbstractGremlinServerIntegrationTest.java      | 25 ++++++-
 .../gremlin/server/GremlinDriverIntegrateTest.java | 85 +++++++++++-----------
 .../server/GremlinServerHttpIntegrateTest.java     |  6 +-
 .../gremlin/server/GremlinServerIntegrateTest.java | 22 +++++-
 .../server/GremlinServerSessionIntegrateTest.java  | 25 ++-----
 8 files changed, 137 insertions(+), 73 deletions(-)

diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
index e527b1f,c394531..2b66ce1
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
@@@ -18,9 -18,8 +18,10 @@@
   */
  package org.apache.tinkerpop.gremlin.server;
  
 +import org.apache.tinkerpop.gremlin.server.channel.UnifiedChannelizer;
 +import org.apache.tinkerpop.gremlin.server.channel.UnifiedChannelizerIntegrateTest;
  import org.apache.tinkerpop.gremlin.server.op.OpLoader;
+ import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
  import org.junit.After;
  import org.junit.Before;
  import org.junit.Rule;
@@@ -170,21 -162,24 +177,31 @@@ public abstract class AbstractGremlinSe
          return (directory.delete());
      }
  
-     protected static void assumeNeo4jIsPresent() {
-         boolean neo4jIncludedForTesting;
+     protected static void tryIncludeNeo4jGraph(final Settings settings) {
+         if (isNeo4jPresent()) {
+             deleteDirectory(new File("/tmp/neo4j"));
+             settings.graphs.put("graph", "conf/neo4j-empty.properties");
+         }
+     }
+ 
+     protected static boolean isNeo4jPresent() {
          try {
              Class.forName("org.neo4j.tinkerpop.api.impl.Neo4jGraphAPIImpl");
-             neo4jIncludedForTesting = true;
+             return true;
 -        } catch (Exception ex) {
 +        } catch (Throwable ex) {
-             neo4jIncludedForTesting = false;
+             return false;
          }
+     }
+ 
+     protected static void assumeNeo4jIsPresent() {
+         boolean neo4jIncludedForTesting = isNeo4jPresent();
          assumeThat("Neo4j implementation was not included for testing - run with -DincludeNeo4j", neo4jIncludedForTesting, is(true));
      }
 +
 +    private boolean shouldTestUnified() {
 +        // ignore all tests in the UnifiedChannelizerIntegrateTest package as they are already rigged to test
 +        // over the various channelizer implementations
 +        return Boolean.parseBoolean(System.getProperty("testUnified", "false")) &&
 +                !this.getClass().getPackage().equals(UnifiedChannelizerIntegrateTest.class.getPackage());
 +    }
  }
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index 5ab086b,15b3004..7f78dd5
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@@ -97,6 -97,6 +97,7 @@@ import static org.hamcrest.number.Order
  import static org.hamcrest.number.OrderingComparison.lessThanOrEqualTo;
  import static org.junit.Assert.assertEquals;
  import static org.junit.Assert.assertFalse;
++import static org.junit.Assert.assertNotNull;
  import static org.junit.Assert.assertNull;
  import static org.junit.Assert.assertTrue;
  import static org.junit.Assert.fail;
@@@ -1472,13 -1521,13 +1472,13 @@@ public class GremlinDriverIntegrateTes
              assertThat(root, instanceOf(ResponseException.class));
              final ResponseException re = (ResponseException) root;
              assertEquals(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS, re.getResponseStatusCode());
-         }
- 
-         final Client rebound = cluster.connect().alias("graph");
-         final Vertex v = rebound.submit("g.addVertex(T.label,'person')").all().get().get(0).getVertex();
-         assertEquals("person", v.label());
  
-         cluster.close();
+             final Client rebound = cluster.connect().alias("graph");
 -            final Vertex v = rebound.submit("g.addVertex('name','jason')").all().get().get(0).getVertex();
 -            assertEquals("jason", v.value("name"));
++            final Vertex v = rebound.submit("g.addVertex(T.label,'person')").all().get().get(0).getVertex();
++            assertEquals("person", v.label());
+         } finally {
+             cluster.close();
+         }
      }
  
      @Test
@@@ -1493,14 -1542,14 +1493,14 @@@
              final Throwable root = ExceptionUtils.getRootCause(ex);
              assertThat(root, instanceOf(ResponseException.class));
              final ResponseException re = (ResponseException) root;
 -            assertEquals(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION, re.getResponseStatusCode());
 +            assertEquals(ResponseStatusCode.SERVER_ERROR_EVALUATION, re.getResponseStatusCode());
-         }
- 
-         final Client rebound = cluster.connect().alias("graph");
-         final Vertex v = rebound.submit("g.addVertex(label,'person','name','jason')").all().get().get(0).getVertex();
-         assertEquals("person", v.label());
  
-         cluster.close();
+             final Client rebound = cluster.connect().alias("graph");
 -            final Vertex v = rebound.submit("g.addVertex('name','jason')").all().get().get(0).getVertex();
 -            assertEquals("jason", v.value("name"));
++            final Vertex v = rebound.submit("g.addVertex(label,'person','name','jason')").all().get().get(0).getVertex();
++            assertEquals("person", v.label());
+         } finally {
+             cluster.close();
+         }
      }
  
      @Test
@@@ -1782,28 -1816,39 +1784,28 @@@
      public void shouldSendRequestIdBytecode() {
          final UUID overrideRequestId = UUID.randomUUID();
          final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRAPHSON_V3D0).create();
-             final Client client = Mockito.spy(cluster.connect().alias("g"));
-             Mockito.when(client.alias("g")).thenReturn(client);
-             GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(client));
-             g.with(Tokens.REQUEST_ID, overrideRequestId).V().iterate();
-             cluster.close();
-             ArgumentCaptor<RequestOptions> requestOptionsCaptor = ArgumentCaptor.forClass(RequestOptions.class);
-             verify(client).submitAsync(Mockito.any(Bytecode.class), requestOptionsCaptor.capture());
-             RequestOptions requestOptions = requestOptionsCaptor.getValue();
-             assertTrue(requestOptions.getOverrideRequestId().isPresent());
-             assertEquals(overrideRequestId, requestOptions.getOverrideRequestId().get());
+         final Client client = Mockito.spy(cluster.connect().alias("g"));
+         Mockito.when(client.alias("g")).thenReturn(client);
+         final GraphTraversalSource g = traversal().withRemote(DriverRemoteConnection.using(client));
+         g.with(Tokens.REQUEST_ID, overrideRequestId).V().iterate();
+         cluster.close();
  
-             ArgumentCaptor<RequestMessage> requestMessageCaptor = ArgumentCaptor.forClass(RequestMessage.class);
-             verify(client).submitAsync(requestMessageCaptor.capture());
-             RequestMessage requestMessage = requestMessageCaptor.getValue();
-             assertEquals(overrideRequestId, requestMessage.getRequestId());
+         final ArgumentCaptor<RequestOptions> requestOptionsCaptor = ArgumentCaptor.forClass(RequestOptions.class);
+         verify(client).submitAsync(Mockito.any(Bytecode.class), requestOptionsCaptor.capture());
+         final RequestOptions requestOptions = requestOptionsCaptor.getValue();
+         assertTrue(requestOptions.getOverrideRequestId().isPresent());
+         assertEquals(overrideRequestId, requestOptions.getOverrideRequestId().get());
  
+         final ArgumentCaptor<RequestMessage> requestMessageCaptor = ArgumentCaptor.forClass(RequestMessage.class);
+         verify(client).submitAsync(requestMessageCaptor.capture());
+         final RequestMessage requestMessage = requestMessageCaptor.getValue();
+         assertEquals(overrideRequestId, requestMessage.getRequestId());
      }
  
 -    private void assertFutureTimeout(final CompletableFuture<List<Result>> futureFirst) {
 -        try {
 -            futureFirst.get();
 -            fail("Should have timed out");
 -        } catch (Exception ex) {
 -            final Throwable root = ExceptionUtils.getRootCause(ex);
 -            assertThat(root, instanceOf(ResponseException.class));
 -            assertThat(root.getMessage(), startsWith("Evaluation exceeded the configured 'evaluationTimeout' threshold of 250 ms"));
 -        }
 -    }
 -
      @Test
      public void shouldClusterReadFileFromResources() throws Exception {
          final Cluster cluster = Cluster.open(TestClientFactory.RESOURCE_PATH);
--        assertTrue(cluster != null);
++        assertNotNull(cluster);
          cluster.close();
      }
  
@@@ -1847,10 -1894,10 +1850,10 @@@
              logger.info("Verifying driver cannot connect to server.");
              client.submit("g").all().get(500, TimeUnit.MILLISECONDS);
              fail("Should throw an exception.");
-         } catch (RuntimeException re) {
+         } catch (Exception re) {
              // Client would have no active connections to the host, hence it would encounter a timeout
              // trying to find an alive connection to the host.
 -            assertThat(re.getCause(), instanceOf(NoHostAvailableException.class));
 +            assertThat(re, instanceOf(NoHostAvailableException.class));
  
              //
              // should recover when the server comes back
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index 71c5401,4a95ae3..fd12632
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@@ -381,7 -335,37 +386,7 @@@ public class GremlinServerIntegrateTes
      }
  
      @Test
-     public void shouldTimeOutRemoteTraversalWithPerRequestOption() {
 -    public void shouldTimeOutRemoteTraversalUsingDeprecatedConfiguration() throws Exception {
 -        final GraphTraversalSource g = traversal().withRemote(conf);
 -
 -        try {
 -            // tests sleeping thread
 -            g.inject(1).sideEffect(Lambda.consumer("Thread.sleep(10000)")).iterate();
 -            fail("This traversal should have timed out");
 -        } catch (Exception ex) {
 -            final Throwable t = ex.getCause();
 -            assertThat(t, instanceOf(ResponseException.class));
 -            assertEquals(ResponseStatusCode.SERVER_ERROR_TIMEOUT, ((ResponseException) t).getResponseStatusCode());
 -        }
 -
 -        // make a graph with a cycle in it to force a long run traversal
 -        graphGetter.get().traversal().addV("person").as("p").addE("self").to("p").iterate();
 -
 -        try {
 -            // tests an "unending" traversal
 -            g.V().repeat(__.out()).until(__.outE().count().is(0)).iterate();
 -            fail("This traversal should have timed out");
 -        } catch (Exception ex) {
 -            final Throwable t = ex.getCause();
 -            assertThat(t, instanceOf(ResponseException.class));
 -            assertEquals(ResponseStatusCode.SERVER_ERROR_TIMEOUT, ((ResponseException) t).getResponseStatusCode());
 -        }
 -
 -        g.close();
 -    }
 -
 -    @Test
+     public void shouldTimeOutRemoteTraversalWithPerRequestOption() throws Exception {
          final GraphTraversalSource g = traversal().withRemote(conf);
  
          try {
@@@ -1055,22 -1220,8 +1065,26 @@@
              fail("Should have tanked out because of number of parameters used and size of the compile script");
          } catch (Exception ex) {
              assertThat(ex.getMessage(), containsString("The Gremlin statement that was submitted exceeds the maximum compilation size allowed by the JVM"));
+         } finally {
+             cluster.close();
          }
      }
 +
 +    @Test
 +    public void shouldGenerateTemporaryErrorResponseStatusCode() throws Exception {
 +        final Cluster cluster = TestClientFactory.build().create();
 +        final Client client = cluster.connect();
 +
 +        try {
 +            client.submit("g.addV('person').sideEffect{throw new org.apache.tinkerpop.gremlin.server.util.DefaultTemporaryException('try again!')}").all().get();
 +            fail("Should have tanked since we threw an exception out manually");
 +        } catch (Exception ex) {
 +            final Throwable t = ex.getCause();
 +            assertThat(t, instanceOf(ResponseException.class));
 +            assertEquals("try again!", t.getMessage());
 +            assertEquals(ResponseStatusCode.SERVER_ERROR_TEMPORARY, ((ResponseException) t).getResponseStatusCode());
++        } finally {
++            cluster.close();
 +        }
 +    }
  }
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index 588d36b,5af4f60..a7e7ac2
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
@@@ -107,13 -100,13 +106,19 @@@ public class GremlinServerSessionIntegr
                  processorSettings.config = new HashMap<>();
                  processorSettings.config.put(SessionOpProcessor.CONFIG_SESSION_TIMEOUT, 3000L);
                  settings.processors.add(processorSettings);
 +
 +                // Unified setting
 +                settings.sessionLifetimeTimeout = 3000L;
                  break;
 -            case "shouldBlockAdditionalRequestsDuringClose":
 -            case "shouldBlockAdditionalRequestsDuringForceClose":
 +            case "shouldCloseSessionOnClientClose":
 +            case "shouldCloseSessionOnClientCloseWithStateMaintainedBetweenExceptions":
-                 clearNeo4j(settings);
+             case "shouldExecuteInSessionAndSessionlessWithoutOpeningTransactionWithSingleClient":
+             case "shouldExecuteInSessionWithTransactionManagement":
+             case "shouldRollbackOnEvalExceptionForManagedTransaction":
++            case "shouldNotExecuteQueuedRequestsIfOneInFrontOfItFails":
+                 tryIncludeNeo4jGraph(settings);
++            case "shouldBlowTheSessionQueueSize":
++                settings.maxSessionTaskQueueSize = 1;
                  break;
              case "shouldEnsureSessionBindingsAreThreadSafe":
                  settings.threadPoolWorker = 2;
@@@ -134,72 -118,23 +139,57 @@@
                  processorSettingsForDisableFunctionCache.config = new HashMap<>();
                  processorSettingsForDisableFunctionCache.config.put(SessionOpProcessor.CONFIG_GLOBAL_FUNCTION_CACHE_ENABLED, false);
                  settings.processors.add(processorSettingsForDisableFunctionCache);
 +
 +                // UnifiedHandler settings
 +                settings.useCommonEngineForSessions = false;
 +                settings.useGlobalFunctionCacheForSessions = false;
 +
                  break;
-             case "shouldExecuteInSessionAndSessionlessWithoutOpeningTransactionWithSingleClient":
-             case "shouldExecuteInSessionWithTransactionManagement":
-             case "shouldRollbackOnEvalExceptionForManagedTransaction":
-             case "shouldNotExecuteQueuedRequestsIfOneInFrontOfItFails":
-                 clearNeo4j(settings);
-                 break;
-             case "shouldBlowTheSessionQueueSize":
-                 clearNeo4j(settings);
-                 settings.maxSessionTaskQueueSize = 1;
-                 break;
          }
  
          return settings;
      }
  
-     private static void clearNeo4j(Settings settings) {
-         deleteDirectory(new File("/tmp/neo4j"));
-         settings.graphs.put("graph", "conf/neo4j-empty.properties");
-     }
- 
      @Test
 -    public void shouldUseGlobalFunctionCache() throws Exception {
 -        final Cluster cluster = TestClientFactory.open();
 -        final Client client = cluster.connect(name.getMethodName());
 +    public void shouldBlowTheSessionQueueSize() throws Exception {
 +        assumeNeo4jIsPresent();
 +        assumeThat(isUsingUnifiedChannelizer(), is(true));
  
 -        try {
 -            assertEquals(3, client.submit("def addItUp(x,y){x+y};addItUp(1,2)").all().get().get(0).getInt());
 -            assertEquals(3, client.submit("addItUp(1,2)").all().get().get(0).getInt());
 -        } finally {
 -            cluster.close();
 +        final Cluster cluster = TestClientFactory.open();
 +        final Client session = cluster.connect(name.getMethodName());
 +
 +        // maxSessionQueueSize=1
 +        // we should be able to do one request at a time serially
 +        assertEquals("test1", session.submit("'test1'").all().get().get(0).getString());
 +        assertEquals("test2", session.submit("'test2'").all().get().get(0).getString());
 +        assertEquals("test3", session.submit("'test3'").all().get().get(0).getString());
 +
 +        final AtomicBoolean errorTriggered = new AtomicBoolean();
 +        final ResultSet r1 = session.submitAsync("Thread.sleep(1000);'test4'").get();
 +
 +        final List<CompletableFuture<List<Result>>> blockers = new ArrayList<>();
 +        for (int ix = 0; ix < 512 && !errorTriggered.get(); ix++) {
 +            blockers.add(session.submit("'test'").all().exceptionally(t -> {
 +                final ResponseException re = (ResponseException) t.getCause();
 +                errorTriggered.compareAndSet(false, ResponseStatusCode.TOO_MANY_REQUESTS == re.getResponseStatusCode());
 +                return null;
 +            }));
 +
 +            // low resource environments like travis might need a break
 +            if (ix % 32 == 0) Thread.sleep(500);
          }
 +
 +        // wait for the blockage to clear for sure
 +        assertEquals("test4", r1.all().get().get(0).getString());
 +        blockers.forEach(CompletableFuture::join);
 +
 +        assertThat(errorTriggered.get(), is(true));
 +
 +        // should be accepting test6 now
 +        assertEquals("test6", session.submit("'test6'").all().get().get(0).getString());
 +
 +        session.close();
 +        cluster.close();
      }
  
      @Test
@@@ -568,7 -370,7 +558,6 @@@
          } finally {
              cluster.close();
          }
--
      }
  
      @Test