You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "guodongxiaren (via GitHub)" <gi...@apache.org> on 2023/02/14 15:17:37 UTC

[GitHub] [brpc] guodongxiaren commented on issue #2081: http_rpc_protocol.cpp中core掉了, 看起来不像是业务代码导致的

guodongxiaren commented on issue #2081:
URL: https://github.com/apache/brpc/issues/2081#issuecomment-1429914105

   @jiangdongzi 自己给函数加noexcept声明即可,可以避免业务代码的异常抛到框架中。
   
   比如service接口的函数:
   ```cpp
       virtual void Echo(google::protobuf::RpcController* cntl_base,
                         const EchoRequest* request,
                         EchoResponse* response,
                         google::protobuf::Closure* done) noexcept {
      }
   ```
   以及这个接口所调用的各种函数。你觉得可能抛异常的都加上。
   C++在异常抛出的链路上遇到首个noexcept声明的地方,就会立刻停止继续往上抛异常,保留此时的栈信息。所以noexcept离实际core的位置越近越准。这个bRPC使用者自己把握即可。兜底的方式是给service接口自行加上noexcept声明。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org