[grpc-io] Trying to catch gRPC cancellation condition

2023-01-24 Thread Clint Olsen
I have a particular gRPC call that may abort unexpectedly and I see this 
when it happens:

events.py:80: RPC cancelled for servicer method []

I'm wondering why this doesn't cause an exception to be thrown so it can be 
caught and handled.

Thanks,

-Clint

-- 
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 grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/c6a37df5-1b14-4ff3-aba8-ab93e326f28cn%40googlegroups.com.


[grpc-io] Can Protobuf serialized data be sent from gRPC server to client?

2023-01-24 Thread Lalitha D
In my Grpc server application, I already have the Protobuf serialized data 
that it received from a different server. Is there a way to avoid 
deserialization in the gRPC server and avoid creating the Protobuf response 
object and directly send theProtobuf serialized data to the client so 
client can do the deserialization ?

my grpc server API currently does this to create Protobuf response.
```
class SampleServiceImpl final : public SampleService::Service {
Status SampleAPI(ServerContext* context, const Request* request, Response* 
response) override { ...
   //already have Protobuf serailized data in 
"serialized_response_msg_buff"
   proto::Response response;
   any.ParseFromArray(serialized_response_msg_buff, 
serialized_response_msg_len);
  any.UnpackTo(response);
} 
```
In my case, the Response object is very heavy and will end up doing 
deserialization twice, one in the above code and once by gRPC service when 
it sends to the client.
Is there a way to avoid the above deserialization and directly pass 
Protobuf serialized data to the gRPC client? 

-- 
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 grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/527d6335-b5a7-415a-bd4e-14b16458bac1n%40googlegroups.com.


[grpc-io] Can Protobuf serialized data be passed from gRPC server to gRPC client ?

2023-01-24 Thread Lalitha D
In my Grpc server application, I already have the Protobuf serialized data 
that it received from a different server. Is there a way to avoid 
deserialization in the gRPC server and avoid creating the Protobuf response 
object and directly send theProtobuf serialized data to the client so 
client can do the deserialization ?

my grpc server API currently does this to create Protobuf response.
class SampleServiceImpl final : public SampleService::Service {
Status SampleAPI(ServerContext* context, const Request* request, Response* 
response) override { ...
   //already have Protobuf serailized data in 
"serialized_response_msg_buff"
   proto::Response response;
   any.ParseFromArray(serialized_response_msg_buff, 
serialized_response_msg_len);
  any.UnpackTo(response);
} 
In my case, the Response object is very heavy and will end up doing 
deserialization twice, one in the above code and once by gRPC service when 
it sends to the client.
Is there a way to avoid the above deserialization and directly pass 
Protobuf serialized data to the gRPC client? 

-- 
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 grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/9bc92812-3280-4d22-9f98-b2990b0d3cben%40googlegroups.com.


[grpc-io] Avoid Deserialization in response

2023-01-24 Thread Lalitha D
In my Grpc server application, I already have the Protobuf serialized data 
that it received from a different server. Is there a way to avoid 
deserialization in the gRPC server and avoid creating the Protobuf response 
object and directly send theProtobuf serialized data to the client so 
client can do the deserialization ?

my grpc server API currently does this to create Protobuf response.
class SampleServiceImpl final : public SampleService::Service {
Status SampleAPI(ServerContext* context, const Request* request, Response* 
response) override { ...
   //already have Protobuf serailized data in 
"serialized_response_msg_buff"
   proto::Response response;
   any.ParseFromArray(serialized_response_msg_buff, 
serialized_response_msg_len);
  any.UnpackTo(response);
}
Is there a way to avoid the above deserialization and directly pass 
Protobuf serialized data to the gRPC client? 

-- 
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 grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/a32efe43-f7a4-44b4-8303-58f3b1b3c724n%40googlegroups.com.


[grpc-io] gRPC-Java 1.45.4 released

2023-01-24 Thread 'Terry Wilson' via grpc.io
The v1.45.4 release is now available.

*Bug Fixes*

   - core: Free unused MessageProducer in RetriableStream (#9853 
   )
   

-- 
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 grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/96564ba3-0fc9-4ff8-a2ca-5cf8bb60b423n%40googlegroups.com.


[grpc-io] OPENSSL_internal:CERTIFICATE_VERIFY_FAILED

2023-01-24 Thread Leila Fathi
I am using self-signed certifcate for my client and generate RA-TLS 
certificate for server and get 
error: OPENSSL_internal:CERTIFICATE_VERIFY_FAILED when I want to connect to 
the server here is my server.py:
if __name__ == '__main__': # calling ra_tls_create_key_and_crt_der from 
library libra_tls_attest libra_tls_attest = 
ctypes.CDLL(os.path.abspath("/usr/local/lib/x86_64-linux-gnu/gramine/runtime/glibc/libra_tls_attest.so"))
 
libra_tls_attest.ra_tls_create_key_and_crt_der.argtypes = 
(ctypes.POINTER(ctypes.POINTER(ctypes.c_uint8)), 
ctypes.POINTER(ctypes.c_size_t),ctypes.POINTER(ctypes.POINTER(ctypes.c_uint8)), 
ctypes.POINTER(ctypes.c_size_t)) 
libra_tls_attest.ra_tls_create_key_and_crt_der.restype = ctypes.c_int # 
Create the input and output variables der_key_size = ctypes.c_size_t() 
der_crt_size = ctypes.c_size_t() der_key = ctypes.POINTER(ctypes.c_uint8)() 
der_crt = ctypes.POINTER(ctypes.c_uint8)() # Call the function 
ret=libra_tls_attest.ra_tls_create_key_and_crt_der(ctypes.byref(der_key), 
ctypes.byref(der_key_size), ctypes.byref(der_crt), 
ctypes.byref(der_crt_size)) # Check the return value if ret != 0: 
print("Error: ra_tls_create_key_and_crt_der returned", ret) else: # convert 
der_cert and der_key to bytes cert_bytes = bytes(ctypes.string_at(der_crt, 
der_crt_size.value)) key_bytes = bytes(ctypes.string_at(der_key, 
der_key_size.value)) # Use the output variables cert = 
x509.load_der_x509_certificate(cert_bytes, backend=default_backend()) 
pem_cert = cert.public_bytes(encoding=serialization.Encoding.PEM) key = 
serialization.load_der_private_key(key_bytes, None, default_backend()) 
pem_key = 
key.private_bytes(encoding=serialization.Encoding.PEM,format=serialization.PrivateFormat.PKCS8,encryption_algorithm=serialization.NoEncryption())
 
# create a gRPC server server = 
grpc.server(futures.ThreadPoolExecutor(max_workers=10)) # create gRPC 
server credentials server_credentials = grpc.ssl_server_credentials( 
((pem_key, pem_cert), )) # add the servicer created above to the server 
service_pb2_grpc.add_ExecserviceServicer_to_server(serviceExecutionImp(), 
server) # listen on port 50051 print('Starting gRPC server. Listening on 
port 50051.',flush=True) server.add_secure_port('localhost:50051', 
server_credentials) server.start() # since server.start() will not block, # 
a sleep-loop is added to keep alive try: while True: time.sleep(86400) 
except KeyboardInterrupt: server.stop(0)
and client.py:
path_to_cert="keys/cert.pem"

with open(path_to_cert, 'rb') as f:
certificate = f.read()
cert_cn = "localhost" 
options = (('grpc.ssl_target_name_override', cert_cn,),)
credentials = grpc.ssl_channel_credentials(certificate)
channel = grpc.secure_channel(server_address_str+":50051", 
credentials,options)
stub = datacontract_pb2_grpc.ExecDataContractStub(channel)
this is cert.pem:
-BEGIN CERTIFICATE-
MIIFCzCCAvOgAwIBAgIUVvHh3v24VTkjJAm+sHB5aS1lBCswDQYJKoZIhvcNAQEL
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MCAXDTIzMDEyMzE2MjcyNVoYDzMwMjIw
NTI2MTYyNzI1WjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCzIwz6/N/Xd5oyZuXtNZ7s+Sxmq9svpY6g87Mp/SSa
3vCaGTGGpUKA8/98HSmJZl2feqToF2hJHLK7JlczE+JxR2s+2ImRWv27/3/11MK4
Tp9xvx0rGnwY7eGvFHYdxUAobJZnwekrjFTgL4HEuWjZ6uagFKrPimmLnxAvRvaM
CaeD42WzidCaFbsCoMqKHoek+mUsb8Q5+npDcqB0hjflTpHFqAvEb9FdRILThzSf
wZlfE6rZIHUuHUV8k9nVLK+6ZnVY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Bh3AIZCJWyAk1DbFNV/sIrBaiGN3Pq8mLbXlKomuKSL6wpMufpD
pFEBIkhFDzVN8Ix4Nt/A4zb9qb66c6z2ULyrsq53o30Lp83JsR25rQ3sMDhMXOGi
NrR0ZkbFYSPKGnVzsG5sr/8xcrkpXB/iYhiVDRM6upJAfsSx4ElXvc8vhTWvLvk=
-END CERTIFICATE-
I have no idea why is not working , server is listening and when I run 
clinet.py :
   return _end_unary_response_blocking(state, call, False, None)
  File 
"/home/sgx_user/.local/lib/python3.8/site-packages/grpc/_channel.py", line 
849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_Inactiv

[grpc-io] Re: absl related Compilation Error of grpc cpp serve and client

2023-01-24 Thread David Nkanga
What was the order of the flag you used?

On Wednesday, January 19, 2022 at 10:27:04 AM UTC cansu gençoğlu wrote:

> I changed the order of the libs while linking and the only remaining error 
> is below. As I understand this 
> `absl::lts_20210324::Mutex::~Mutex()' function is in 
> libabsl_synchronization.a that I already link this library. Any ideas?
>
> Interface.grpc.pb.cc.o: in function 
> `grpc::CompletionQueue::~CompletionQueue()':
> /home/cansuge/CLionProjects/Projects/rpc/lib/includes/grpcpp/impl/codegen/completion_queue.h:119:
>  
> undefined reference to `absl::lts_20210324::Mutex::~Mutex()'
> /usr/bin/ld: CMakeFiles/test.dir/src/MPUInterface.grpc.pb.cc.o: in 
> function 
> `grpc::CompletionQueue::CompletionQueue(grpc_completion_queue_attributes 
> const&)':
>
>
> Best Regards,
>
> Cansu
> 18 Ocak 2022 Salı tarihinde saat 16:29:03 UTC+1 itibarıyla cansu gençoğlu 
> şunları yazdı:
>
>> Hi to all,
>>
>> I am trying to compile basic grpc cpp server and client test code without 
>> installation of the library. I compile all the libraries and link to my 
>> project I believe. However, I got these errors while linking stage. May be 
>> I forgot to link some libs or add include files. Any comment would help. 
>> Thanks.
>>
>>
>> /usr/bin/ld: CMakeFiles/test.dir/src/MPUInterface.grpc.pb.cc.o: in 
>> function `grpc::CompletionQueue::~CompletionQueue()':
>> /home/cansuge/CLionProjects/Projects/rpc/lib/includes/grpcpp/impl/codegen/completion_queue.h:119:
>>  
>> *undefined reference to `absl::lts_20210324::Mutex::~Mutex()'*
>> /usr/bin/ld: CMakeFiles/test.dir/src/MPUInterface.grpc.pb.cc.o: in 
>> function 
>> `grpc::CompletionQueue::CompletionQueue(grpc_completion_queue_attributes 
>> const&)':
>> /home/cansuge/CLionProjects/Projects/rpc/lib/includes/grpcpp/impl/codegen/completion_queue.h:253:
>>  
>> *undefined reference to `absl::lts_20210324::Mutex::~Mutex()'*
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libgrpc.a(cluster.upbdefs.c.o):(.data.rel+0x28):
>>  
>> *undefined reference to 
>> `envoy_config_core_v3_config_source_proto_upbdefinit'*
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libgrpc.a(extension.upbdefs.c.o):(.data.rel+0x0):
>>  
>> *undefined reference to 
>> `envoy_config_core_v3_config_source_proto_upbdefinit'*
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libgrpc.a(health_check.upbdefs.c.o):(.data.rel+0x8):
>>  
>> *undefined reference to 
>> `envoy_config_core_v3_event_service_config_proto_upbdefinit'*
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libgrpc.a(endpoint_components.upbdefs.c.o):(.data.rel+0x10):
>>  
>> undefined reference to `envoy_config_core_v3_config_source_proto_upbdefinit'
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libgrpc.a(route.upbdefs.c.o):(.data.rel+0x8):
>>  
>> undefined reference to `envoy_config_core_v3_config_source_proto_upbdefinit'
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libgrpc.a(http_connection_manager.upbdefs.c.o):(.data.rel+0x10):
>>  
>> undefined reference to `envoy_config_core_v3_config_source_proto_upbdefinit'
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libgrpc.a(secret.upbdefs.c.o):(.data.rel+0x8):
>>  
>> undefined reference to `envoy_config_core_v3_config_source_proto_upbdefinit'
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libabsl_cordz_info.a(cordz_info.cc.o):
>>  
>> in function 
>> `absl::lts_20211102::cord_internal::CordzInfo::Head(absl::lts_20211102::cord_internal::CordzSnapshot
>>  
>> const&)':
>> cordz_info.cc:(.text+0xc43): *undefined reference to 
>> `absl::lts_20211102::cord_internal::CordzHandle::DiagnosticsHandleIsSafeToInspect(absl::lts_20211102::cord_internal::CordzHandle
>>  
>> const*) const'*
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libabsl_cordz_info.a(cordz_info.cc.o):
>>  
>> in function 
>> `absl::lts_20211102::cord_internal::CordzInfo::Next(absl::lts_20211102::cord_internal::CordzSnapshot
>>  
>> const&) const':
>> cordz_info.cc:(.text+0xd65): undefined reference to 
>> `absl::lts_20211102::cord_internal::CordzHandle::DiagnosticsHandleIsSafeToInspect(absl::lts_20211102::cord_internal::CordzHandle
>>  
>> const*) const'
>> /usr/bin/ld: cordz_info.cc:(.text+0xd8c): undefined reference to 
>> `absl::lts_20211102::cord_internal::CordzHandle::DiagnosticsHandleIsSafeToInspect(absl::lts_20211102::cord_internal::CordzHandle
>>  
>> const*) const'
>> /usr/bin/ld: 
>> /home/cansuge/CLionProjects/Projects/rpc/lib/libnew/libabsl_cordz_info.a(cordz_info.cc.o):
>>  
>> in function 
>> `absl::lts_20211102::cord_internal::CordzInfo::CordzInfo(absl::lts_20211102::cord_internal::CordRep*,
>>  
>> absl::lts_20211102::cord_internal::CordzInfo const*, 
>> absl::lts_20211102::cord_internal::CordzUpdateTracker::MethodIdentifier)':
>> cordz_info.cc:(.text+0x12d8): undefined reference to 
>> `absl::l