You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am currently making a server with Drogon and struggled on an issue on how to close the server.
Currently, my idea is to throw an exception during the initialization of a custom plugin (like throw std::runtime_error) to exit the run() function, then I try to queue the quit operation, the function does return to 0 but drogon hangs in the deconstructor calls.
This is what happens in the console during shutdown:
20250514 16:34:03.655000 UTC 31772 TRACE [~CacheMap] CacheMap destruct! - drogon/CacheMap.h:161
The code is stuck at the destructor of EventLoopThread:
std::call_once(once_, [this]() {
auto f = promiseForLoop_.get_future();
promiseForRun_.set_value(1);
// Make sure the event loop loops before returning.
(void)f.get(); // this is where it gets stuck
});
here I am checking that "f" is empty, not sure if that can be the issue.
Specifically the run function called here:
EventLoopThread::~EventLoopThread()
{
run(); // this is where it hangs
std::shared_ptr<EventLoop> loop;
{
std::unique_lock<std::mutex> lk(loopMutex_);
loop = loop_;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am currently making a server with Drogon and struggled on an issue on how to close the server.
Currently, my idea is to throw an exception during the initialization of a custom plugin (like throw std::runtime_error) to exit the run() function, then I try to queue the quit operation, the function does return to 0 but drogon hangs in the deconstructor calls.
This is my main code:
This is what happens in the console during shutdown:
20250514 16:34:03.655000 UTC 31772 TRACE [~CacheMap] CacheMap destruct! - drogon/CacheMap.h:161
The code is stuck at the destructor of EventLoopThread:
here I am checking that "f" is empty, not sure if that can be the issue.
Specifically the run function called here:
Perhaps I'm simply doing the stop part wrong?
Beta Was this translation helpful? Give feedback.
All reactions