-
Notifications
You must be signed in to change notification settings - Fork 517
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
Reflection issues #22
Comments
@jamisonhyatt, this is a problem in the Go protobuf runtime regarding how file descriptors that are compiled into your binary are "linked". They are linked purely by name. What that means is that the name (and relative path) used to compile a proto with protoc must exactly match how all other files will import it. In your test repo, note that However it is imported with a You can fix this by adjusting the include path arguments to protoc so that you import it as simply |
This was a phenomenal explanation, and helped me out a lot. I appreciate the details, and the raising of the external issue, as well. I'm totally cool with closing this issue. |
I came here with exactly the same issue, perfect explanation :) |
I just ran into this, except I have no If you're in the same boat as me, it is probably because you are using gogoprotobuf with |
see https://github.com/tanjunchen/grpc-test-demo My project can run, and the go client can call the go server grpc service.
|
@tanjunchen, if you are using gogoproto (instead of the golang/protobuf library), then the issue you linked is most likely the underlying issue. Server reflection being coupled to the golang/protobuf library means that when compiled files using gogoproto instead, the descriptors aren't registered in a way that the golang/protobuf library can find them. But if you are using normal You would need to double-check how all files in the transitive closure of your service are compiled and make sure that the relative path given to protoc when compiling a given file exactly matches the relative file used for all import statements of that same file. If you are using Go for your server, you might upgrade to v1.4 of the golang/protobuf runtime. IIUC, it will enforce that the relative paths are consistent and the program will fail to init if things are wrong. |
@jhump thanks . I guess that the problems are from the |
Could some one give a practical example of what @jhump explains? I can't get this to work irregardless of the folder structure or naming og the proto file, the import statements in the .proto file and the imports in the go files. Even if all of them are the same. Nothing is shown when I try to list packages or messages. |
@ohenrik, are you getting an error message? Or is it just showing nothing? If the latter and just showing nothing, I think your server is not correctly setup with regards to the reflection service. I can't help too much on that unless you are using Go, since that is the main runtime whose service reflection feature is familiar to me. But in Go, there's usually not too much to actually configure -- it's supposed to be more or less automatic. One possible issue, if it's a Go service, could be if you are using gogo protobuf instead of the normal runtime, which has compatibility issues. |
@jhump I'm using Go. Not sure If I'm using gogo proof, I installed the default following the gRPC basic tutorial website. My impression was also that this should work magically by just adding the reflection registration as per the documentation. But since there is no errors etc. I find it hard to debug. Is there a way to print anything inside the server it self to show what reflection has registered? |
@jhump the info you've provided here is fantastic! Thanks for all of that. In my case, I think the I created a repo where I've reproduced the issue with the simplest version of the real problem I'm facing when trying to use reflection with a project that imports an external .proto. Would you mind taking a look when you get a chance? Edit Got it sorted out. I needed to change the file location and the |
@jhuggart, looks like the problem is in your dependency. You are importing the file as I would file an issue against their repo that they should generate the protos providing the same full path to |
everybody Tks. |
I have a proto set with 3 gRPC services (and some external dependencies) that compiles appropriately on the protobuf side, compiles and runs in go, and clients work when interacting with the server, but reflection fails within
grpcurl
on the 2 services which have dependencies in other packages.I recreated a fake weatherman repo with a similar setup to provide an example.
proto & generated code repo: https://github.com/jamisonhyatt/grpc-multi-pkg-protos
Client gist: https://gist.github.com/jamisonhyatt/dd9d93b978472c960c9fa81b9f39fcf9
Here's
tree
of the protosetlist
returnsweatherman.Weatherman.Healthcheck
returnslist mobile.Mobile
throws an errorI'd like to avoid refactoring the packages (which does work, but I have to flatten them) but I'd like to know of this is a symptom of how I have the packae imports, the gRPC reflection service, or the reflection in
grpcurl
itself.My feeling though, is that if the protos compile, the server compiles, the reflection service should have enough information to define the types. Any feedback is appreciated.
Edit: just for posterity, building the protosets and using those with grpcurl does work.
The text was updated successfully, but these errors were encountered: