[Java] Localhost host used on transaction in bytecode queries
See original GitHub issueHello,
I think there is an issue with transactions in bytecode.
software.amazon.neptune:gremlin-client version 1.0.6 org.apache.tinkerpop:gremlin-driver version 3.5.2
When I try to open a new one : var transaction = traversal().withRemote(DriverRemoteConnection.using(client)).tx();
The method GraphTraversalSource.tx()
will trigger the DriverRemoteConnection.tx()
which use here the client.getCluster()
which return the “parentCluster” initialized into the GremlinCluster.connect()
with a null value Cluster parentCluster = clusterBuilder.apply(null);
which return a cluster with an host to localhost by default when address is null.
The transaction should use the client attribute into the AliasClusteredClient
and not the cluster attribute or the parentCluster
is not well built maybe ?
I tried to override the parentCluster
(GremlinCluster line 57) with one Cluster created with my neptune address and the transaction work.
I can’t only do transaction, queries works fine and query well my neptune cluster.
The exception on tx() :
java.util.concurrent.CompletionException: Could not initialize 1 (minPoolSize) connections in pool. Successful connections=0. Closing the connection pool. at org.apache.tinkerpop.gremlin.driver.ConnectionPool.<init>(ConnectionPool.java:130) at org.apache.tinkerpop.gremlin.driver.Client$SessionedClient.initializeImplementation(Client.java:834) at org.apache.tinkerpop.gremlin.driver.Client.init(Client.java:214) at org.apache.tinkerpop.gremlin.driver.Client$AliasClusteredClient.init(Client.java:714) at org.apache.tinkerpop.gremlin.driver.Client.submitAsync(Client.java:383) at org.apache.tinkerpop.gremlin.driver.Client$AliasClusteredClient.submitAsync(Client.java:701) at org.apache.tinkerpop.gremlin.driver.Client$AliasClusteredClient.submitAsync(Client.java:679) at org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection.submitAsync(DriverRemoteConnection.java:229) at org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTransaction.submitAsync(DriverRemoteTransaction.java:172) at org.apache.tinkerpop.gremlin.process.remote.traversal.step.map.RemoteStep.promise(RemoteStep.java:89) at org.apache.tinkerpop.gremlin.process.remote.traversal.step.map.RemoteStep.processNextStart(RemoteStep.java:65) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:135) at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:40) at org.apache.tinkerpop.gremlin.process.traversal.Traversal.iterate(Traversal.java:210) at org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal.iterate(GraphTraversal.java:3053) at org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal$Admin.iterate(GraphTraversal.java:192) at org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal.iterate(DefaultGraphTraversal.java:48) at com.seqvoia.gremlin.Main.main(Main.java:47) Caused by: org.apache.tinkerpop.gremlin.driver.exception.ConnectionException: Could not open Connection{host=Host{address=localhost/127.0.0.1:8182, hostUri=wss://localhost:8182/gremlin}}, {channel=null} at org.apache.tinkerpop.gremlin.driver.Connection.<init>(Connection.java:135) at org.apache.tinkerpop.gremlin.driver.ConnectionPool.lambda$new$0(ConnectionPool.java:103) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1800) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:832) Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:8182 Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:660) at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:875)
Thank you in advance, have a good day.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
I was successfully able to reproduce the issue and I now see what you’re referring to. The issue seems to be with the
DriverRemoteConnection.tx()
call when creating aTransaction
object. That particular method usesclient.getCluster()
, [1] which we presently do not override in theGremlinClient
class.I’m looking at a fix that would create an overridden
getCluster()
method in theGremlinClient
that would fetch an availableClient
(much like how thechooseConnection()
method currently works) in order to return the parentCluster
object for thatClient
to return for the creation of theTransaction
. I’ll try to have something next week for review.[1] https://github.com/apache/tinkerpop/blob/4c09ceef17611ca57e2faf4546960cac333d76f3/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java#L282
Hi @Pred05 Thanks for reporting this. I’ve created a PR to fix this issue, and update the readme with an example:
https://github.com/awslabs/amazon-neptune-tools/pull/275
/cc @triggan