I am trying to connect to gRPC server like following:
grpc::ChannelArguments ca;
ca.SetMaxReceiveMessageSize(-1);
std::shared_ptr<grpc::Channel> channel = grpc::CreateCustomChannel(ip, grpc::InsecureChannelCredentials(), ca);
Not frequenty, but some times I get this error:
Unhandled exception thrown: read access violation. grpc_core::Timestamp::ScopedSource::previous(...) returned nullptr. occurred
I am not getting what is the error. I tried to catch if any exception but could not catch it. If there is some help really appreciate it.
It would be good if there is a way to catch the exception.
When getting a read access violation error, it often indicates a problem with memory access or pointer handling... You need to ensure that the pointer being accessed is valid before de-referencing it.
One method is to add a null pointer check before using the pointer. For example:
And here's an example of how you can catch exceptions during the gRPC channel creation: