question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Java] Localhost host used on transaction in bytecode queries

See original GitHub issue

Hello,

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:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
triggancommented, Sep 24, 2022

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 a Transaction object. That particular method uses client.getCluster(), [1] which we presently do not override in the GremlinClient class.

I’m looking at a fix that would create an overridden getCluster() method in the GremlinClient that would fetch an available Client (much like how the chooseConnection() method currently works) in order to return the parent Cluster object for that Client to return for the creation of the Transaction. 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

0reactions
iansrobinsoncommented, Dec 9, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Send queries to the server as bytecode rather than as strings
If the query is sent as a bytecode submission, the server only spends time retrieving the ID and the label of the vertex....
Read more >
linkedin-skill-assessments-quizzes/spring-framework-quiz.md ...
It's a transaction attribute configured by spring. · It's a transaction that must actively validate by the bytecode of a transaction using Spring's ......
Read more >
Unable to create requested service [org.hibernate.engine.jdbc ...
Cause: The error occurred since hibernate is not able to connect to the database. Solution: 1. Please ensure that you have a database...
Read more >
A Practical Guide to Java Remote Debugging in the Real World
Learn how to prepare your environment for remote debugging connections and what tools to use to successfully debug a production system.
Read more >
Byte Code Adapter (Introscope JAVA Agent) - SAP Blogs
Hello All, Today I would like to talk about the Byte Code Adapter ... to see that Host, Process name and Agent Name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found