Gremlin Driver TimeoutException

929 views
Skip to first unread message

pavel.s...@glowbyteconsulting.com

unread,
May 16, 2016, 1:11:48 PM5/16/16
to Gremlin-users
Hi all,
I faced problem connectiong to GremlinServer (Titan Server) from Java Gremlin Driver. Here is my code:
Cluster cluster = Cluster.open();
Client client = cluster.connect();
ResultSet results = client.submit("TitanGraph graph = TitanFactory.build()."+
 
"set(\"gremlin.graph\", \"com.thinkaurelius.titan.core.TitanFactory\")."+
 
"set(\"storage.backend\", \"cassandrathrift\")."+
 
"set(\"storage.hostname\", \"10.104.xxx.xxx\")."+
 
"open();");
Error:
20:01:35,709  INFO ConnectionPool:98 - Opening connection pool on Host{address=localhost/127.0.0.1:8182, hostUri=ws://localhost:8182/gremlin} with core size of 2
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.TimeoutException
 at org
.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:135)
 at org
.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:119)

The same code on server-side works well in Gremlin Console. Connection through Java API also works fine:
TitanFactory.Builder config = TitanFactory.build();
config
.set("storage.backend", "cassandrathrift");
config
.set("storage.hostname", "10.104.xxx.xxx");
TitanGraph graph = config.open();

Where can be problem here?? Thanks.

Stephen Mallette

unread,
May 16, 2016, 1:17:45 PM5/16/16
to Gremlin-users
you shouldn't create a TitanGraph instance from the driver with a script. You should just be referencing an existing Graph or GraphTraversalSource instance already configured on the server via the yaml file.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/a0cb1e28-fa96-490a-84d8-aca6a97b2d92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pavel.s...@glowbyteconsulting.com

unread,
May 17, 2016, 4:25:25 AM5/17/16
to Gremlin-users
Error is remains:
11:17:37,759  INFO ConnectionPool:98 - Opening connection pool on Host{address=10.104.xxx.xxx/10.104.xxx.xxx:8182, hostUri=ws://10.104.xxx.xxx:8182/gremlin} with core size of 2
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.TimeoutException
at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:135)
at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:119)

Cluster cluster = Cluster.open("remote-objects.yaml");
remote-objects.yaml:
hosts: [10.104.xxx.xxx]
port: 8182
serializer
: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { custom: [com.thinkaurelius.titan.graphdb.relations.RelationIdentifier] }}

My conf file is local, is it ok? How to point it to remote server file? (In this case I have "Configuration file at /opt/titan-1.0.0-hadoop1/conf/remote-objects.yaml does not exist" error).

Stephen Mallette

unread,
May 17, 2016, 6:57:08 AM5/17/16
to Gremlin-users
You say error remains, but you also aren't showing what kind of script you are sending or giving me much context on when that error is occurring. I expect that you are getting the TimeoutException when you actually submit() a request? Since you are using Titan I would expect that you are on 1.0 and that means TinkerPop 3.0.x. There have been a lot of changes to timeouts since then so I can't remember what the exact behaviors were in that version, but the TimeoutException could just mean that you aren't actually connecting to the server in the first place. A connection is not really established until you submit that first request (the connection pools are merely initialized). Make sure you can connect via localhost first to ensure everything is working and then try a remote connection from a different instance. If it works as localhost, but still fails as remote then make sure you have appropriate port accessible externally and that your "host" setting in your Gremlin Server yaml file is not still set to localhost - it basically needs to be bound to the IP address of the instance it is on. I'd say that's the usual problem most people have.

pavel.s...@glowbyteconsulting.com

unread,
Jun 10, 2016, 12:26:16 PM6/10/16
to Gremlin-users
Hi, Stephen,
Yes, I have Titan 1.0 and TP3. Yes, it fails on submit() method. Here is my code:
Cluster cluster = Cluster.open("remote.yaml");
Client client = cluster.connect();
ResultSet results = client.submit("1");
When I try to connect locally, it is ok:
1) I edited file conf/remote.yaml and set actual IP adress instead if localhost;
2) In Gremlin console:
gremlin> :plugin use tinkerpop.server
==>tinkerpop.server activated
gremlin> :remote connect tinkerpop.server conf/remote.yaml
gremlin>
gremlin> 1
==>1
So, locally it works fine. Firewall is off.

Stephen Mallette

unread,
Jun 10, 2016, 12:54:10 PM6/10/16
to Gremlin-users
what about this point i made:

that your "host" setting in your Gremlin Server yaml file is not still set to localhost 

is that set to "10.104.xx.xx" or whatever your server host/ip is?

pavel.s...@glowbyteconsulting.com

unread,
Jun 10, 2016, 1:02:12 PM6/10/16
to Gremlin-users
Yes, it is not localhost.
Also, connection works fine with Gremlin/Tinkerpop API, e.g.:
TitanFactory.Builder config = TitanFactory.build();
config
.set("storage.cassandra.keyspace", schema);

config
.set("storage.backend", "cassandrathrift");

config
.set("storage.hostname", host);
TitanGraph graph = config.open();
Vertex v0 = graph.traversal().V().has(uidKey, UID).next();

Stephen Mallette

unread,
Jun 10, 2016, 1:11:45 PM6/10/16
to Gremlin-users
I'm sorry but I'm not sure what to tell you then. I'm not aware of users generally having this problem or else the mailing list would have been lit up with complaints. There must be something in your configuration that remains amiss, but I'm not seeing it from what you're describing. Not sure if anyone else can take a stab at this one, but I'm out of ideas. 

Jason Plurad

unread,
Jun 10, 2016, 1:50:12 PM6/10/16
to Gremlin-users
I'll take a shot...

I created this example project recently https://github.com/pluradj/titan-tp3-driver-example
I just tested it successfully with my machine's IP address updated properly in all the appropriate configs.


-- Jason

Jason Plurad

unread,
Jun 10, 2016, 1:53:48 PM6/10/16
to Gremlin-users
Also, after the server is started, make sure to verify which IP the Gremlin Server port 8182 is listening on with lsof or ss or netstat.

ahalya.la...@gmail.com

unread,
May 16, 2017, 10:41:05 AM5/16/17
to Gremlin-users
Hi Jason Plurad,

I know this is an old post but facing the same issue mentioned.
i cloned your project mentione in above comment and tried running it.It works fine but for big queries it throws time out exception.I could nt find any methods to set time out value in either Client/Cluster .
Please tell me if I can set the time out value.
Reply all
Reply to author
Forward
0 new messages