Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
renbou opened this issue Apr 4, 2024 · 1 comment

Comments

@renbou
Copy link

renbou commented Apr 4, 2024

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:

def _file_descriptor_response(
self,
file_descriptor: FileDescriptor,
) -> ServerReflectionResponse:
proto = FileDescriptorProto()
file_descriptor.CopyToProto(proto) # type: ignore
return ServerReflectionResponse(
file_descriptor_response=FileDescriptorResponse(
file_descriptor_proto=[proto.SerializeToString()],
),
)

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
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants