<_MultiThreadedRendezvous of RPC that terminated with: details = "Exception iterating requests!"

3,311 views
Skip to first unread message

Rag esh

unread,
Apr 28, 2021, 8:05:36 AM4/28/21
to grpc.io

I am trying to create a bidirectional streaming service using gRPC.
### Proto definition

    syntax = "proto3";
    
    message Features {
        int32 id = 1;
        float sensor1 = 2 ;
        float sensor2 = 3 ;
        float sensor3 = 4 ;
        float sensor4 = 5 ;
    }
    message Empty{}
    
    service StreamDataBroker{
        rpc StreamDataBroker(stream Empty) returns(stream Features);
    }

### Server snippet

    def StreamDataBroker(self, requests, context):
        #csv_filename = "./dataset/sensors.csv"
        response = msg.Features()
        for request in requests:
            print("server running")
            total_rows = row_obj.init_count()
            current_row = row_obj.current_row
            row = row_obj.get_next_row(current_row)
            response.id = row[0]
            response.sensor1 = row[1]
            response.sensor2 = row[2]
            response.sensor3 = row[3]
            response.sensor4 = row[4]
            row_obj.current_row = row_obj.current_row + 1
    
            yield response

### Client snippet

    def send_request_stream(self):
        request = empty_pb2.Empty()
        responses = self.stub.StreamDataBroker(request)
        for response in responses:
            print(response)

When I try to run the client I get the following error

    Traceback (most recent call last):
      File "client.py", line 27, in <module>
        main()
      File "client.py", line 22, in main
        client.send_request_stream()
      File "client.py", line 17, in send_request_stream
        for response in responses:
      File "/home/edge/.local/lib/python3.8/site-packages/grpc/_channel.py", line 426, in __next__
        return self._next()
      File "/home/edge/.local/lib/python3.8/site-packages/grpc/_channel.py", line 809, in _next
        raise self
    grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
            status = StatusCode.UNKNOWN
            details = "Exception iterating requests!"
            debug_error_string = "None"
    >

What is going wrong here and How do I handle iterating requests properly

[Source code][1]

I tried this [solution][2] bud did not work for me.


  [1]: https://github.com/ipa-rar/gRPC-ws/tree/main/data_broker_stream
  [2]: https://github.com/grpc/grpc/issues/13544
Reply all
Reply to author
Forward
0 new messages