0

I use aws-neptune. And I try to implement my queries as transactional(with sessionClient like: https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-sessions.html). But when I try to implement it, closing client throws exception. There is similar issue like my case: https://groups.google.com/g/janusgraph-users/c/N1TPbUU7Szw

My code looks like:

@Bean
public Cluster gremlinCluster()
{
    return Cluster.build()
            .addContactPoint(GREMLIN_ENDPOINT)
            .port(GREMLIN_PORT)
            .enableSsl(GREMLIN_SSL_ENABLED)
            .keyCertChainFile("classpath:SFSRootCAG2.pem")
            .create();
}

private void runInTransaction()
{
    String sessionId = UUID.randomUUID().toString();
    Client.SessionedClient client = cluster.connect(sessionId);

    try
    {
        client.submit("query...");
    }
    finally
    {
        if (client != null)
        {
            client.close();
        }
    }
}

And exception is:

INFO (ConnectionPool.java:225) - Signalled closing of connection pool on Host{address=...} with core size of 1

WARN (Connection.java:322) - Timeout while trying to close connection on ... - force closing - server will close session on shutdown or expiration.

java.util.concurrent.TimeoutException

at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771)

Is there any suggestion?

Sha
  • 921
  • 17
  • 46

1 Answers1

1

This might be a connectivity problem with the server which you are not able to observe while sending the query because you are not waiting for the future to complete.

When you do a client.submit("query...");, you receive a future. You need to wait for that future to complete to observe any exceptions (or success).

I would suggest the following:

  1. Try hitting the server with a health status call using curl to verify connectivity with the server.
  2. Replace the client.submit("query..."); with client.submit("query...").all().join(); to get the error during connection with the server.
Divij
  • 878
  • 2
  • 9
  • 18