pythongrpcpybind11grpc-pythongil

In gRPC Python, do keepalives need to acquire the GIL?


In gRPC Python, are the keepalives pings(https://github.com/grpc/grpc/blob/master/doc/keepalive.md) executed by a Python thread or by some other mechanism (C thread)? If the GIL was unavailable (for example, due to Pybind or Cython not yielding the GIL) would gRPC Python not be able to acknowledge keepalives?


Solution

  • Keepalive pings will be sent by a C thread, which does not require the GIL. All keepalive-related functions are handled by the C core, and gRPC Python only sends the configuration to the core.