rogchap / wombat

Cross platform gRPC client
MIT License
1.4k stars 52 forks source link

Can't see more than one service when using reflection #57

Open howey opened 3 years ago

howey commented 3 years ago

Hi all,

I have a server with two services: Service_A and Service_B. When I use reflection I can only see Service_A. I can see both services if I manually use the .proto files. Any idea what I'm doing wrong?

Using Wombat_v0.4.0_Linux_x86_64.tar.gz

Thanks

wombat

server.cpp:

#include <grpcpp/grpcpp.h>

#include <string>

#include "service_a.grpc.pb.h"
#include "service_b.grpc.pb.h"

using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;

using service_a::Service_A;
using service_b::Service_B;

class ServiceAImplementation final : public Service_A::Service {};

class ServiceBImplementation final : public Service_B::Service {};

void Run() {
  std::string address{"0.0.0.0:5000"};
  ServiceAImplementation service_a;
  ServiceBImplementation service_b;

  ServerBuilder builder;

  builder.AddListeningPort(address, grpc::InsecureServerCredentials());
  builder.RegisterService(&service_a);
  builder.RegisterService(&service_b);

  std::unique_ptr<Server> server(builder.BuildAndStart());
  std::cout << "server listening on port: " << address << std::endl;

  server->Wait();
}

int main(int argc, char** argv) {
  Run();

  return 0;
}

service_b.proto:

syntax = "proto3";

package service_b;

service Service_B{
  rpc DoThing(ThingIn) returns (ThingOut) {}
}

message ThingIn {}
message ThingOut {}

service_a.proto:

syntax = "proto3";

package service_a;

service Service_A{
  rpc DoThing(ThingIn) returns (ThingOut) {}
}

message ThingIn {}
message ThingOut {}

Working with grpc-client-cli:

$ grpc-client-cli localhost:5000
? Choose a service:  [Use arrows to move, enter to select, type to filter]
→ grpc.reflection.v1alpha.ServerReflection
  service_a.Service_A
  service_b.Service_B
rogchap commented 3 years ago

Hmm. that is really strange as you should at least see the grpc.reflection.v1alpha.ServerReflection service too?

image
howey commented 3 years ago

Nope, I don't see grpc.reflection.v1alpha.ServerReflection either.

As another test I tried out grpcui, and the issue is similar. To me it seems like there is a problem in a library that's used by Wombat

 ~/go/bin/grpcui -plaintext localhost:5000
Failed to compute set of methods to expose: Symbol not found: service_b.Service_B
raphaelzulliger commented 2 years ago

I seem to suffer from the same issue, using V0.5.0. grpc_cli ls shows all services, while wombat only shows one of them. I hope the following screenshot is not too much obfuscated :-)

image

Can we enable "logging" or such for wombat to get to the culprit of it?