drogonframework / drogon

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

HttpServer启动失败直接触发abort #2185

Open TYUTthelastone opened 1 month ago

TYUTthelastone commented 1 month ago

HttpServer启动的时候,启用SSL的线程是app().run()的线程,enableSSL触发的runtime_error被HttpServer所属的loop捕获了,导致assertInLoopThread()断言了。

https://github.com/drogonframework/drogon/blob/3fce70b535dcee9efb2f5f805d8a81d04a5adeb3/lib/src/ListenerManager.cc#L78-L193

TYUTthelastone commented 1 month ago

应该是enable中抛出异常后httpserver析构导致的,具体析构流程是 ~HttpServer->~TcpServer->~Acceptor->Channel::disableAll()->Channel::update()->EventLoop::updateChannel()->EventLoop::assertInLoopThread()