Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gremlin Javascript Traversal Never Resolves

I'm trying to use the gremlin npm module and connect to a Neptune database. During testing, I tried having gremlin connect to an inactive endpoint and invalid url to make the system more resilient. I expected some sort of error to be thrown. However, with invalid/inactive urls, graph traversals just don't resolve with no messaging.

        const traversal = gremlin.process.AnonymousTraversalSource.traversal;
        const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
        const dc = new DriverRemoteConnection('wss://localhost:80');
        const g = traversal().withRemote(dc);
        const data = await g.V().limit(1).toList();
        console.log(data);

I'd expect g.V().limit(1).toList() to throw an error when using an invalid remote connection. Again, the promise never resolves and the console.log(data) on the next line is never run.

Any help with this would be much appreciated! I need some sort of system to detect whether the database connection is valid and if not logs errors.

like image 604
deterministic_ram Avatar asked May 31 '20 18:05

deterministic_ram


1 Answers

There is an issue in the current JavaScript GLV, we've filed TINKERPOP-2381 that summarizes the problems.

This should not affect the GLV when the address points to a valid server.

Thanks for providing so much detail in the question.


I'm adding an answer so that this thread is preserved.

After investigation if the host does not exist the 3.4.1 JavaScript Gremlin client throws an exception and exits the process. With the 3.4.4 client (or later) the error seems to get silently swallowed.

like image 96
Kelvin Lawrence Avatar answered Nov 18 '22 11:11

Kelvin Lawrence