'Custom Signal handling with gRPC?
I have gRPC client implemented in C++ application. I also use sigaction as custom signal handling. On catching specific signals I send gRPC message to another gRPC server, then exists.
I have noted the following, my custom handlers are not invoked if I called grpc::CreateChannel before sigaction, instead I get Problem with executing command "/bin/bash /var/tmp/scl7oNQHY".
But I reversed the order of the execution, my handler is invoked.
I have tested this behavior for SIGINT, SIGUSR1, SIGFPE and it's the same.
std::stringstream unixSocketName;
unixSocketName << "unix:///tmp/appname" << getpid() << ".sock";
std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(
unixSocketName.str(), grpc::InsecureChannelCredentials());
int sig_no = SIGINT; // I repeat this for multiple signals.
act.sa_sigaction = HandleSignal;
act.sa_flags = SA_SIGINFO;
auto status = sigaction(sig_no, &act, NULL);
Any insights ?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
