0

I build a client to feed some data to my modelserver inside docker-container using grpc and c++.

when trying to connect i get message: error 14 connection reset by peer.

client code:

std::cout << "calling prediction service on " << "localhost:8500" 
<< std::endl;
    ServingClient sclient(grpc::CreateChannel(
        "localhost:8500", grpc::InsecureChannelCredentials()));
    std::vector<float> reply = sclient.callPredict(model_name, 
model_signature_name, data);

tensorflow serving commmand:

tensorflow_model_server --port=8500 --rest_api_port=8501 -- model_name=best_model --model_base_path=/models/best_model/

docker container output:

2019-08-12 13:59:29.851181: I tensorflow_serving/core/loader_harness.cc:86] Successfully loaded servable version {name: best_model version: 1} 2019-08-12 13:59:29.854813: I tensorflow_serving/model_servers/server.cc:324] Running gRPC ModelServer at 0.0.0.0:8500 ... [warn] getaddrinfo: address family for nodename not supported [evhttp_server.cc : 239] RAW: Entering the event loop ... 2019-08-12 13:59:29.858052: I tensorflow_serving/model_servers/server.cc:344] Exporting HTTP/REST API at:localhost:8501 ...

client output: calling prediction service on localhost:8500 Generated Proto Tensor OK gRPC call return code: 14: Connection reset by peer gRPC failed

dhaunss
  • 1
  • 2
  • "Connection reset by peer" may suggest that the server isn't listening on the ip:port that the client is targetting. You say that you are running the server in a docker container on port 8500, and the client is targeting the loopback interface and port 8500 - if so, one of the following should be satisfied in order for this to work: a) use docker host networking i.e. --net host, for the server b) target the docker container's IP rather than your machine's localhost, c) your client must run within the same docker container as your server. – apolcyn Aug 14 '19 at 18:36
  • by targeting the docker-ip you mean using 0.0.0.0: rather than "localhost" right? i already tried and did not improve. i am pretty sure my client code is working properly cause when tarteting different server(outside of docker) i get connection. when i use REST interface to communicate with the docker container i get : curl: (56) Recv failure: Connection reset by peer . A different threat suggested it might be caused by wrong port mapping inside container. But i am using only the tensorflow serving command. – dhaunss Aug 15 '19 at 08:01
  • Not quite, targeting 0.0.0.0 is also not correct. Note that docker networking uses a "docker bridge" - see https://docs.docker.com/v17.09/engine/userguide/networking/#default-networks and related for more details. In short, docker containers by default, don't "share" network interfaces with the host. One way to find out the docker IP that you can use to reach your container from your host (or another container) is to run "docker inspect ", and see the "IPAddress" field. A simple example way to get the container id is to run "docker container ls" – apolcyn Aug 15 '19 at 18:21

1 Answers1

0

I can not rly post an answer but my problem just resolved after doing an fresh ubuntu install.

But i can not say how this relates to my problem.

dhaunss
  • 1
  • 2