Unable to connect to the grpc service using python library

3,107 views
Skip to first unread message

brot...@gmail.com

unread,
Jun 14, 2018, 7:28:33 PM6/14/18
to grpc.io
I am having issues in connecting to the grpc service running in GO using the python library

I am using  the library


    grpcio==1.10.1


Here is my code

    import grpc
    from hello_world import hello_world_pb2_grpc
    from hello_world import hello_world_pb2
    channel = grpc.insecure_channel('localhost:5000')
    stub =hello_world_pb2_grpc.CallStub(channel)
    stub.Call()


I am getting the following error after setting the debug mode on when I do

    channel = grpc.insecure_channel('localhost:5000')


    >>> E0614 21:11:00.273830440   14198 channel_connectivity.cc:126] watch_completion_error: "Cancelled"
    E0614 21:11:00.273870160   14198 completion_queue.cc:634]    Operation failed: tag=0x7fbaab82b320, error={"created":"@1529010660.273816994","description":"Timed out waiting for connection state change","file":"src/core/ext/filters/client_channel/channel_connectivity.cc","file_line":133}
    E0614 21:11:00.474877364   14195 channel_connectivity.cc:126] watch_completion_error: "Cancelled"
    E0614 21:11:00.474967852   14195 completion_queue.cc:634]    Operation failed: tag=0x7fbaab82b358, error={"created":"@1529010660.474849365","description":"Timed out waiting for connection state change","file":"src/core/ext/filters/client_channel/channel_connectivity.cc","file_line":133}
    E0614 21:11:00.675819616   14198 channel_connectivity.cc:126] watch_completion_error: "Cancelled"
    E0614 21:11:00.675860536   14198 completion_queue.cc:634]    Operation failed: tag=0x7fbaab82b358, error={"created":"@1529010660.675806653","description":"Timed out waiting for connection state change","file":"src/core/ext/filters/client_channel/channel_connectivity.cc","file_line":133}
    
    E0614 21:11:00.876819325   14195 channel_connectivity.cc:126] watch_completion_error: "Cancelled"
    E0614 21:11:00.876855700   14195 completion_queue.cc:634]    Operation failed: tag=0x7fbaab82b320, error={"created":"@1529010660.876806994","description":"Timed out waiting for connection state change","file":"src/core/ext/filters/client_channel/channel_connectivity.cc","file_line":133}



This is what the error looks like

    E0614 19:43:39.385612320    8409 lockfree_event.cc:209]      LockfreeEvent::SetReady: 0x7f7b18001a28 curr=0x7f7b14001120
    E0614 19:43:39.385634661    8409 lockfree_event.cc:209]      LockfreeEvent::SetReady: 0x7f7b18001a30 curr=0x2
    E0614 19:43:39.385664271    8409 lockfree_event.cc:94]       LockfreeEvent::NotifyOn: 0x7f7b18001a28 curr=(nil) closure=0x7f7b14001120
    E0614 19:43:39.390243947    8409 lockfree_event.cc:209]      LockfreeEvent::SetReady: 0x7f7b18001a28 curr=0x7f7b14001120
    E0614 19:43:39.390261213    8409 lockfree_event.cc:209]      LockfreeEvent::SetReady: 0x7f7b18001a30 curr=0x2
    E0614 19:43:39.390363730    8409 lockfree_event.cc:160]      LockfreeEvent::SetShutdown: 0x7f7b18001a28 curr=(nil) err={"created":"@1529005419.390300526","description":"Delayed close due to in-progress write","file":"src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":589,"referenced_errors":[{"created":"@1529005419.390289956","description":"Endpoint read failed","file":"src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2446,"occurred_during_write":0,"referenced_errors":[{"created":"@1529005419.390275545","description":"Socket closed","fd":7,"file":"src/core/lib/iomgr/tcp_posix.cc","file_line":423,"grpc_status":14,"target_address":"ipv4:127.0.0.1:8081"}]}]}
    E0614 19:43:39.390380912    8409 lockfree_event.cc:160]      LockfreeEvent::SetShutdown: 0x7f7b18001a30 curr=0x2 err={"created":"@1529005419.390300526","description":"Delayed close due to in-progress write","file":"src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":589,"referenced_errors":[{"created":"@1529005419.390289956","description":"Endpoint read failed","file":"src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2446,"occurred_during_write":0,"referenced_errors":[{"created":"@1529005419.390275545","description":"Socket closed","fd":7,"file":"src/core/lib/iomgr/tcp_posix.cc","file_line":423,"grpc_status":14,"target_address":"ipv4:127.0.0.1:8081"}]}]}
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/me/lib/python3.6/site-packages/grpc/_channel.py", line 500, in __call__
        return _end_unary_response_blocking(state, call, False, None)
      File "/home/me/lib/python3.6/site-packages/grpc/_channel.py", line 434, in _end_unary_response_blocking
        raise _Rendezvous(state, None, None, deadline)
    grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNAVAILABLE, Socket closed)>


It is showing it is not able to connect to the given service at the given port. However, other services are able to connect to the given port, written in other languages.

Also if I do telnet `localhost:5000`, it is able to connect

Any ideas what could be the issue?

Srini Polavarapu

unread,
Jun 20, 2018, 1:45:56 PM6/20/18
to grpc.io
Same question posted on stackoverflow. Someone from gRPC team responded there. We can followup over there. https://stackoverflow.com/questions/50014425/not-able-to-connect-to-go-grpc-server-using-python-client
Reply all
Reply to author
Forward
0 new messages