drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.04k stars 1.06k forks source link

偶而零星的segment fault? #2084

Open bethebest0622 opened 3 days ago

bethebest0622 commented 3 days ago

您好,drogon非常好用,我http这端完全基于drogon开发

我的场景是: 有一个母进程,隔一段时间会开一些 使用drogon的子进程,每个子进程只运行30分钟,控制进程一天要断断续续的开几千个drogon进程(同时存在的drogon进程少于300个)

基本上运行良好,但是每天大概会有30个core dumped

gdb的堆栈信息如下:

(gdb) where
#0  0x00007fdb816c1acf in raise () from /lib64/libc.so.6
#1  0x00007fdb81694ea5 in abort () from /lib64/libc.so.6
#2  0x00007fdb8206209b in __gnu_cxx::__verbose_terminate_handler() [clone .cold.1] () from /lib64/libstdc++.so.6
#3  0x00007fdb8206854c in __cxxabiv1::__terminate(void (*)()) () from /lib64/libstdc++.so.6
#4  0x00007fdb820685a7 in std::terminate() () from /lib64/libstdc++.so.6
#5  0x00007fdb8206853e in std::rethrow_exception(std::__exception_ptr::exception_ptr) () from /lib64/libstdc++.so.6
#6  0x00007fdb82b5e175 in trantor::EventLoop::loop() () from /usr/local/lib/libcurl_util.so
#7  0x00007fdb82b5eed0 in trantor::EventLoopThread::loopFuncs() () from /usr/local/lib/libcurl_util.so
#8  0x00007fdb82094b23 in execute_native_thread_routine () from /lib64/libstdc++.so.6
#9  0x00007fdb8252e1ca in start_thread () from /lib64/libpthread.so.0
#10 0x00007fdb816ace73 in clone () from /lib64/libc.so.6

这些偶发的core dumped 让我很困扰,因为无法复现出来,您有没有一些看法或者建议? 感谢

我的drogon进程用法是

int main(int argc, char ** argv) {
  std::thread t([] () {
    // drogon::app().setIntSignalHandler(sg);
    drogon::app().disableSigtermHandling();
    drogon::app().run();
  }); 
  t.detach();

 // 主逻辑循环。。。。
}
an-tao commented 2 days ago

父进程如何干掉子进程的?子进程收到系统消息调用了drogon::app().quit()?

bethebest0622 commented 2 days ago

父进程如何干掉子进程的?子进程收到系统消息调用了drogon::app().quit()?

子进程有计时器,到了规定的时候 exit(1)

an-tao commented 2 days ago

这样是增加了爆的风险,试试我说的方案,定时器到时调用app().quit()

bethebest0622 commented 2 days ago

好的 我试试