Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http_rpc_protocol.cpp中core掉了, 看起来不像是业务代码导致的 #2081

Open
jiangdongzi opened this issue Jan 11, 2023 · 5 comments

Comments

@jiangdongzi
Copy link

image

@jiangdongzi
Copy link
Author

偶发

@jiangdongzi
Copy link
Author

编译所用commit a0fc1a2

@lorinlee
Copy link
Contributor

可能是业务代码把内存写坏了,这个问题好复现不,建议开ASAN复现下。

@jiangdongzi
Copy link
Author

可能是业务代码把内存写坏了,这个问题好复现不,建议开ASAN复现下。

定位了下, 是业务代码导致, 很容易复现,example中的echo server中throw 就可以复现。 但是这种定位core太不友好了 @wwbmmm 不知道是否可以改进下。

@guodongxiaren
Copy link
Member

@jiangdongzi 自己给函数加noexcept声明即可,可以避免业务代码的异常抛到框架中。

比如service接口的函数:

    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声明。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants