vmagamedov / grpclib

Pure-Python gRPC implementation for asyncio
http://grpclib.readthedocs.io
BSD 3-Clause "New" or "Revised" License
921 stars 93 forks source link

ServerReflection doesn't respond with transitive dependencies as its supposed to by the standard #187

Open renbou opened 3 months ago

renbou commented 3 months ago

As seen in the implementation of gRPC reflection inside grpclib, only the single requested file descriptor proto is returned instead of the whole transitive dependency chain: https://github.com/vmagamedov/grpclib/blob/3c0fa03c3134a2d766ab050911bde81ebc9ecbae/grpclib/reflection/service.py#L57-L67

It is specified in the gRPC reflection design doc and in the proto definition that File* queries should return the whole dependency chain, since otherwise it's pretty much impossible to use the returned descriptors. Of course this isn't a massive problem for the base case where a file imports some well-known protos, wrapperspb for example, but if a file depends on other files, then they aren't returned and the whole process fails. This pretty much means that the reflection client has to manually go requesting for each of the dependencies, which isn't really a solution when the dependency chain is large (proto by default supports dependency chains up to 10k in length).

Is this something that can be resolved in grpclib? This is honestly the only usable gRPC library for Python :P

vmagamedov commented 2 months ago

Our reflection implementation was written by using grpcio-reflection as a reference. Maybe you can point where it currently differs from original implementation or even create a PR with a fix?