typedb / typedb-driver-python

TypeDB Driver for Python

Home Page:https://typedb.com

Repository from Github https://github.comtypedb/typedb-driver-pythonRepository from Github https://github.comtypedb/typedb-driver-python

Internal gRPC error when querying for data

tomassabat opened this issue · comments

(this bug only happens sometimes)

Description

I am testing client python with different read queries. Before running into the errors described below, the query was working fine. But after running it twice, I now get the Exceptions below.

Environment

  1. OS: Mac OS 10.14
  2. Grakn version: Grakn Core 2.0.0-alpha
  3. Grakn client-python version: client-python 2.0.0-alpha-4
  4. Python version: 3.9

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Run this grakn distribution: https://www.dropbox.com/s/1y3ophwlv6xyg2z/grakn-2.0-alpha-tomas-20210109.zip?dl=0
  2. In a terminal run python, and run:
from grakn.client import GraknClient, SessionType, TransactionType
client = GraknClient("localhost:1729")
session = client.session("biograkn_covid_16", SessionType.DATA)
tx = session.transaction(TransactionType.READ)
answer_iterator = tx.query().match("match $x isa protein, has uniprot-id $uid; get $uid;")
for answer in answer_iterator:
	person = answer.get("uid")
	print("Retrieved protein with id " + person.get_iid())
  1. After some data gets returned, I see this error:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/grakn/rpc/stream.py", line 57, in __next__
    return next(self)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/grakn/rpc/stream.py", line 50, in __next__
    res = self._transaction._fetch(self._request_id)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/grakn/rpc/transaction.py", line 136, in _fetch
    response = next(self._response_iterator)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/grpc/_channel.py", line 416, in __next__
    return self._next()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/grpc/_channel.py", line 778, in _next
    operating = self._call.operate(
  File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 277, in grpc._cython.cygrpc.IntegratedCall.operate
  File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 102, in grpc._cython.cygrpc._operate_from_integrated_call
  File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 110, in grpc._cython.cygrpc._operate_from_integrated_call
  File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 57, in grpc._cython.cygrpc._raise_call_error_no_metadata
ValueError: Internal gRPC call error 8. Please report to https://github.com/grpc/grpc/issues
  1. Then I run again:
answer_iterator = tx.query().match("match $x isa protein, has uniprot-id $uid; get $uid;")
for answer in answer_iterator:
	person = answer.get("uid")
	print("Retrieved protein with id " + person.get_iid())

And I see this error:

Exception in thread Thread-29:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "src/python/grpcio/grpc/_cython/_cygrpc/thread.pyx.pxi", line 53, in grpc._cython.cygrpc._run_with_context._run
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/grpc/_channel.py", line 1238, in channel_spin
    call_completed = event.tag(event)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/grpc/_channel.py", line 166, in handle_event
    callbacks = _handle_event(event, state, response_deserializer)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/grpc/_channel.py", line 131, in _handle_event
    state.due.remove(operation_type)
KeyError: 5

Expected Output

I expect data to be returned in the console.

Actual Output

The first error returns a ValueError: Internal gRPC call error 8., and the second time I am returned with an Exception in thread Thread-29:

Additional information

image

After this error, I close both the session and transaction. After I open a new session, I try to open a new transaction. However, this hangs and nothing happens:
image

With the latest version (Alpha-2.0.0-version2) I am unable to reproduce this bug.

We've proceeded far beyond the steps above with BioGrakn now. So we can safely assume this bug no longer exists. Going to close it for now.