typedb / typedb-driver-python

TypeDB Driver for Python
https://typedb.com
Apache License 2.0
67 stars 25 forks source link

Client-side timeout #11

Closed lolski closed 1 year ago

lolski commented 5 years ago

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();
        }
    }
  3. Pause grakn in the middle: kill -STOP <grakn process id>
  4. 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
  2. The provided timeout value should be used to set the deadline of GRPC requests.
alexjpwalker commented 3 years ago

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

lolski commented 2 years ago

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

alexjpwalker commented 2 years ago

Yes

alexjpwalker commented 1 year ago

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.