始终将失败的gRPC的UNKNOWN状态代码发送到python服务器

时间:2018-01-12 12:08:55

标签: python protocol-buffers grpc

我的data.proto喜欢这个:

syntax = "proto3";
package rpc;
service Performer {
  rpc carryOut(Image) returns (Objects){}
}

message Objects{
    repeated Object objects=1;
}

message Object{
    string type=1;
}

和这样的实现:

class Performer(data_pb2_grpc.PerformerServicer):
    def __init__(self):
        pass

    def carryOut(self, req, cxt):
         objs=Objects()
         obj=objs.objects.add()
         obj.type='Person'
         return objs    

客户请求总是得到:

    self.res = self.client().carryOut(self.data()) 
  File "/usr/local/lib/python2.7/dist-packages/grpc/_channel.py", line 484, in __call__
    return _end_unary_response_blocking(state, call, False, deadline)
  File "/usr/local/lib/python2.7/dist-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.UNKNOWN, Stream removed)>

并且服务器崩溃并出现错误:   分段错误(书面转储)

它发生在笔记本电脑中:

 ubuntu 16.04
 python 2.7.12
 grpcio==1.8.4
 grpcio-tools==1.8.4

0 个答案:

没有答案