Any reason why mg_mgr_poll might take forever to finish/freeze in 7.13? #3032
-
I encountered a freeze today and I think it was likely mg_mgr_poll not returning (lasted over 10 hours, not sure if it would have eventually resolved). Got a c++ thread that looks like this in my code: static void NET_HTTP_ServerPollLoop() {
for (;;) {
mg_mgr_poll(&srv.mgr, POLL_MSEC);
if (srv.end_poll_loop.load()) {
return;
}
}
} The main thread of my program starts this thread sometimes and then ends it again/joins it and restarts it. When it tries to join it, it sets srv.end_poll_loop to true like this: srv.end_poll_loop = true;
srv.thread.join(); The starting of the thread looks like this: srv.end_poll_loop = false;
srv.thread = std::thread(NET_HTTP_ServerPollLoop); Now, what happened is that it got stuck on the thread join. It didn't crash or anything, it just never joined the thread. This was on Ubuntu Linux, in a debug build running inside gdb. The mongoose version I use is 7.13. I would update and see if it solves the problem, but sadly this is the first time it ever happened in 5 months and I don't think I can reproduce it and sadly I missed out on saving a coredump. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
We don't offer support for past versions, unless you are a paying customer, in which case please contact Support as per your contract.
If you absolutely need multi-threading, take the time to go through the user guide (linked above) and tutorials, there is one that shows you how to do multi-threading. If that is the case, the reason why "the glitch" didn't manifest before is just that you've been "lucky". |
Beta Was this translation helpful? Give feedback.
-
Was mostly just hoping to hear whether a bug like this is known and has been fixed in recent versions because I sadly have no way to reproduce the error, but oh well. The multithreading code was written by some ppl who are way smarter than me and presumptively know what they're doing but who knows. Thanks. |
Beta Was this translation helpful? Give feedback.
We don't offer support for past versions, unless you are a paying customer, in which case please contact Support as per your contract.
Current Mongoose is 7.16 and HEAD will be turning into 7.17 soon
The word "thread" causes me goose bumps, because of this:
From the docs
If you absolutely need multi-threading, take the time to go through the user guide (linked above) and tutorials, there is one that shows you how to do multi-threading.
If that is the case, the reason why "the glitch" didn't manifest before is just that you've been …