typedb-driver-python icon indicating copy to clipboard operation
typedb-driver-python copied to clipboard

Client-side timeout

Open lolski opened this issue 6 years ago • 3 comments

Client-python does not set a client-side timeout, and will stall forever if the network gets interrupted

Grakn version: 1.5

Reproducible step:

  1. Start grakn: grakn server start
  2. Run the python-equivalent of the following Java queries using client-python:
try (GraknClient.Session session = new GraknClient("localhost:48555").session("grakn")) {
        while (true) {
                GraknClient.Transaction tx = session.transaction(Transaction.Type.WRITE);
                tx.execute(Graql.match(var("x").sub("thing")).get());
                System.out.println("query");
                tx.commit();
        }
}
  1. Pause grakn in the middle: kill -STOP <grakn process id>
  2. Observe that the queries will stall and never times out

TODO

  1. The client should be able to set a timeout when instantiating the client. We need to set a default, eg., 15 seconds.
client1 = new Grakn(DEFAULT_URI, 20) // timeout set to 20 seconds
client2 = new Grakn(DEFAULT_URI) // timeout set to the default timeout, eg., 15 seconds
  1. The provided timeout value should be used to set the deadline of GRPC requests.

lolski avatar Feb 19 '19 18:02 lolski

We should re-test this issue now that 2.0.0 alpha is out.

alexjpwalker avatar Dec 17 '20 10:12 alexjpwalker

Yes we should. This issue is really old but it's still worth testing right @alexjpwalker ?

lolski avatar Nov 02 '21 10:11 lolski

Yes

alexjpwalker avatar Nov 02 '21 12:11 alexjpwalker

I couldn't reproduce the issue locally. When I kill my server instance, the in-progress network call immediately terminates with an exception.

This is in line with what is expected from the current client architecture. Closing.

alexjpwalker avatar Jan 11 '23 15:01 alexjpwalker