-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async logger crashes on shutdown during tp_.reset()
. Minimal Reproducible Example provided. Does not occur in older versions.
#3100
Comments
tp_.reset()
. Minimal Reproducible Example provided.tp_.reset()
. Minimal Reproducible Example provided. Does not occur in older versions.
May I also ask if I am shutting down spdlog correctly? I assume I need to flush first, delete my loggers, then call shutdown. |
We cannot be sure that
You are correct in that you are calling |
By the way, if you declare a variable in a header file with |
Hmm, I think it should be fine to initialise the |
Sorry, I overlooked that your project uses C++23. C++17 and above, Since you are using C++23, you should leave it as However, since |
In any case, since |
I am still investigating, but the issue for now seems to occur when joining the threads in the thread_pool in the thread_pool's destructor.
|
I built the commit when the issue was opened (TypeDefinition/spdlog_crash@75b9d1cc97ce61698eb76fbae687f7b934b82e7c), but it does not reproduce on my machine. $ cmake -S . -B build
$ cmake --build build
$ spdlog_crash
[2024-05-29 22:27:25.957] [Core Logger] [trace] This is a log.
[2024-05-29 22:27:25.957] [Client Logger] [info] This is a log.
[2024-05-29 22:27:25.957] [Core Logger] [trace] This is a log.
[2024-05-29 22:27:25.957] [Client Logger] [info] This is a log.
[2024-05-29 22:27:25.957] [Core Logger] [trace] This is a log. I assume it is a problem with your machine. |
I am running Windows 11, using CLion, compiler is MinGW Version 11.0 w64. I have narrowed it down to commit 1253a57, where it first started crashing. The error I get is a segfault at stl_tree.h line 788, static _Link_type
_S_right(_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return static_cast<_Link_type>(__x->_M_right); } Maybe I'm just unfamiliar with CLion but I don't see a stack trace anywhere. |
Probably caused by |
Thanks. I can't believe that such a major bug has existed for almost 7 years and there's no plans for MinGW to fix it anytime soon. The last thing I expected was a compiler bug. Just spent an entire day scratching my head on this problem. :") |
Hi, I am consistently crash when I call shutdown() and use async loggers.
I think it has something to do with
tp_
being NULL.The crash only occurs when running in Debug mode, and not in Release mode.
The crash occurs in the latest version of spdlog, commit c3aed4b.
I do not know exactly which commit it came from, but from my testing, an older commit which I have been using until today, da14258, does not have this issue.
You can run the example here to try it out yourself: https://github.com/TypeDefinition/spdlog_crash
This is my
log
class:Here is my main.cpp:
This is the shutdown function which it always crashes.
The text was updated successfully, but these errors were encountered: