You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/11/21 01:58:01 UTC

[GitHub] [incubator-brpc] vinllen commented on issue #1997: 程序内部core但是core栈不完整

vinllen commented on issue #1997:
URL: https://github.com/apache/incubator-brpc/issues/1997#issuecomment-1321346714

   > > > 这个是你业务代码抛出了异常,没有catch,异常逃逸到了brpc框架内。
   > > 
   > > 
   > > 业务代码抛异常为什么会跑到brpc的 SocketDeleter::operator() 函数里呢?
   > > 这种堆栈以前也见过,但想不明白为啥会core在这里
   > 
   > ```c++
   > struct SocketDeleter {
   >     void operator()(Socket* m) const {
   >         DereferenceSocket(m);
   >     }
   > };
   > 
   > typedef std::unique_ptr<Socket, SocketDeleter> SocketUniquePtr;
   > ```
   > 
   > 因为这个是SocketDeleter的operator(),SocketDeleter是作为unique_ptr的删除器的。会在unique_ptr对象析构的时候调用。而所有析构函数在C++11以后默认是noexcept的。所以当检测到异常的时候,程序立即终止。
   > 
   > 前几天我没仔细看这个网友的栈信息。如果是core在SocketDeleter的operator()中,应该是Socket::Dereference这个函数抛出了异常。 我怀疑是这里
   > 
   > ```c++
   >         LOG(FATAL) << "Invalid SocketId=" << id;
   >         return -1;
   >     }
   >     LOG(FATAL) << "Over dereferenced SocketId=" << id;
   > ```
   > 
   > 老问题。当链接了glog的时候,FATAL级别日志,会触发abort抛出异常,导致core。 @wwbmmm
   > 
   > 请问你们是不是链接了glog? @vinllen
   
   我们修改了LOG,统一链接用的外部的spdlog,这个有关系吗?


-- 
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