grpclib icon indicating copy to clipboard operation
grpclib copied to clipboard

Un-debuggable Protocol errror

Open JPFrancoia opened this issue 6 months ago • 1 comments

Hello,

First of, amazing lib, its interface is far superior to the one from the official grpcio.

I have an intermittent problem though: from time to time, the gRPC requests from one Cloud Run (GCP) service to another fails with:

File "/app/gen/experiments/v1/__init__.py", line 336, in get_active_experiment_for_customer
    return await self._unary_unary(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/betterproto/grpc/grpclib_client.py", line 85, in _unary_unary
    response = await stream.recv_message()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/grpclib/client.py", line 425, in recv_message
    await self.recv_initial_metadata()
  File "/app/.venv/lib/python3.12/site-packages/grpclib/client.py", line 367, in recv_initial_metadata
    with self._wrapper:
         ^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/grpclib/utils.py", line 70, in __exit__
    raise self._error
grpclib.exceptions.StreamTerminatedError: Protocol error

This doesn't happen all the time, so that means my setup is somewhat correct. The problem here is that I have no clue about where to start debugging that. It doesn't seem to be an authentication error. I can't figure out what it could be.

Here are the versions if grpclib and betterproto I use:

grpclib = {extras = ["protobuf"], version = "^0.4.7"}
betterproto = "v2.0.0b7"

Would you have an idea about where to start to debug this please? Please let me know if you need extra information.

JPFrancoia avatar Apr 29 '25 08:04 JPFrancoia