Description
When are experiencing an occasional NullPointerException during connection pool initialization. It seems that there is an error while trying to connect to the gremlin database (in our case on Azure). The error triggers the pool to try and kill available connections which results in an unhandled NullPointerException. As a result the original exception is swallowed and the pool never recovers from this state.
java.lang.RuntimeException: Could not initialize client for Host{address=xxxx.gremlin.cosmos.azure.com/10.10.10.10:443, hostUri=wss://xxxx.gremlin.cosmos.azure.com:443/gremlin} at org.apache.tinkerpop.gremlin.driver.Client$ClusteredClient.lambda$new$4(Client.java:571) ~[gremlin-driver-3.5.0.jar!/:3.5.0] at org.apache.tinkerpop.gremlin.driver.Client$ClusteredClient.lambda$null$0(Client.java:529) ~[gremlin-driver-3.5.0.jar!/:3.5.0] at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na] at java.base/java.lang.Thread.run(Unknown Source) ~[na:na] Caused by: java.lang.NullPointerException: null at org.apache.tinkerpop.gremlin.driver.ConnectionPool.killAvailableConnections(ConnectionPool.java:273) ~[gremlin-driver-3.5.0.jar!/:3.5.0] at org.apache.tinkerpop.gremlin.driver.ConnectionPool.closeAsync(ConnectionPool.java:256) ~[gremlin-driver-3.5.0.jar!/:3.5.0] at org.apache.tinkerpop.gremlin.driver.ConnectionPool.<init>(ConnectionPool.java:115) ~[gremlin-driver-3.5.0.jar!/:3.5.0] at org.apache.tinkerpop.gremlin.driver.ConnectionPool.<init>(ConnectionPool.java:78) ~[gremlin-driver-3.5.0.jar!/:3.5.0] at org.apache.tinkerpop.gremlin.driver.Client$ClusteredClient.lambda$new$4(Client.java:565) ~[gremlin-driver-3.5.0.jar!/:3.5.0] ... 5 common frames omitted