drogonframework / drogonframework/drogon

零星的crash

Open
#2,461 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 12h
Merged PRs (30d)
15

Description

您好,我一直使用drogon作为http请求的工具,总体而言非常稳定高效。
我的使用方法是开启一个单独的线程

```
std::thread t([] () {
sigset_t sigset;
sigemptyset(&sigset);
sigaddset(&sigset, SIGINT);
pthread_sigmask(SIG_BLOCK, &sigset, nullptr);
// drogon::app().setIntSignalHandler(sg);
int cpu_cnt = util::common_util::GetCpuCount();
drogon::app().disableSigtermHandling().setThreadNum(MAX(cpu_cnt - 2, 2)).run();
// drogon::app().addListener("0.0.0.0", 80);
// drogon::app().run();
});
t.detach();
```
然后调用这个函数,传入回调处理函数

`ptr_->sendRequest(req_ptr, [f] (const drogon::ReqResult & rq, const drogon::HttpResponsePtr & hh) { f(rq, hh); }, 2);`

最近有一些零星的crash发生,core dump之后gdb的结果是

```
(gdb) where
#0 0x00007fb702f4eafe in epoll_wait () from /lib64/libc.so.6
#1 0x00007fb70381a37a in trantor::EpollPoller::poll(int, std::vector >*) () from /usr/local/lib/libhttp_util.so
#2 0x00007fb7037f5b18 in trantor::EventLoop::loop() () from /usr/local/lib/libhttp_util.so
#3 0x00007fb7037268da in drogon::HttpAppFrameworkImpl::run() () from /usr/local/lib/libhttp_util.so
#4 0x000000000041b5d6 in std::thread::_State_impl > >::_M_run() [clone .lto_priv.0] ()
#5 0x00007fb70355419d in std::execute_native_thread_routine (__p=0xb2ea820) at /home/nwani/m3/conda-bld/compilers_linux-64_1560109574129/work/.build/x86_64-conda_cos6-linux-gnu/src/gcc/libstdc++-v3/src/c++11/thread.cc:80
#6 0x00007fb702e9f832 in start_thread () from /lib64/libc.so.6
#7 0x00007fb702e3f480 in clone3 () from /lib64/libc.so.6
```

似乎是epoll这里crash了,不知道是不是和机器负载太大有关

这个crash发生的频率不高,但是是经常发生(有的时候一天几次,有的时候几天一次,都是相同的crash点)

希望您能给一些排查建议,十分感谢

ps. 我使用的版本是commit 7877fdc47b9689316557241494b2b5ef8e276d17 去年11月14日的那个版本

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.