Please also post the log on the server side. It does look like some error happened in Get_Data handler on the server. Maybe mismatch of generated client_class code between client and server?
On Thu, Sep 24, 2020 at 11:11 AM Jatin Sharma <[email protected]> wrote: > I don't understand the handle terminology. Can you please explain what you > mean by handle. Thanks. > > On Wednesday, September 23, 2020 at 11:08:35 PM UTC+5:30 > [email protected] wrote: > >> I would expect there to be more to the error message than just >> "client_class". I'm assuming there's an indentation problem in your >> original post and that the instantiation of the "client_class" message is >> happening within the Get_Data handler. What happens if you try to >> instantiate a "client_class" outside of the handler, on the main thread. Do >> you get a more illuminating error message? >> On Wednesday, September 23, 2020 at 9:20:45 AM UTC-4 Jatin Sharma wrote: >> >>> I want to send a class to the grpc server. So, I am pickling the class >>> and sharing as a bytes format in the message. >>> The .proto file(serverdata.proto) looks like below: >>> >>> syntax = "proto3"; >>> >>> service DataProvider{ >>> rpc Get_Data(client_class) returns (result); >>> } >>> >>> message client_class{ >>> bytes class_str = 1; >>> } >>> >>> message result{ >>> int64 res = 1; >>> } >>> >>> client.py file looks like below: >>> >>> import grpc >>> import serverdata_pb2 >>> import serverdata_pb2_grpc >>> import pickle >>> import pandas as pd >>> >>> >>> class Get_Hash(): >>> def get_hash(self,df): >>> return pd.util.hash_pandas_object(df).sum() >>> >>> a = serverdata_pb2.client_class() >>> a.class_str = pickle.dumps(Get_Hash) >>> >>> channel = grpc.insecure_channel('localhost:50051') >>> # create a stub (client) >>> stub = serverdata_pb2_grpc.DataProviderStub(channel) >>> response = stub.Get_Data(a) >>> >>> print(response.res) >>> >>> On running this client, I'm getting the following error: >>> >>> Traceback (most recent call last): >>> File "client.py", line 18, in <module> >>> response = stub.Get_Data(a) >>> File >>> "/home/jatin/.local/lib/python3.8/site-packages/grpc/_channel.py", line >>> 826, in __call__ >>> return _end_unary_response_blocking(state, call, False, None) >>> File >>> "/home/jatin/.local/lib/python3.8/site-packages/grpc/_channel.py", line >>> 729, in _end_unary_response_blocking >>> raise _InactiveRpcError(state) >>> grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that >>> terminated with: >>> status = StatusCode.UNKNOWN >>> details = "Exception calling application: client_class" >>> debug_error_string = >>> "{"created":"@1600867086.557068214","description":"Error received from peer >>> ipv6:[::1]:50051","file":"src/core/lib/surface/call.cc","file_line":1061,"grpc_message":"Exception >>> calling application: client_class","grpc_status":2}" >>> > >>> >>> I'm unable to resolve this error. I checked the type of the pickle file. >>> It was 'bytes'. So, I changed the type in the .proto file to bytes. I'd be >>> grateful if someone can help me resolve this error. >>> >>> Regards, >>> Jatin >>> >>> >>> >>> >>> -- > You received this message because you are subscribed to the Google Groups " > grpc.io" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/grpc-io/65656b59-cc4d-40d7-a00f-eef9b8f785ecn%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/65656b59-cc4d-40d7-a00f-eef9b8f785ecn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAABt8Y-bc-HO7amngEAkhJKC%2BGvUyUunUU-Pb6NkdqpDuBeRhg%40mail.gmail.com.
