Skip to content
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

spdlog segfault #1333

Closed
m4ce opened this issue Nov 28, 2019 · 5 comments
Closed

spdlog segfault #1333

m4ce opened this issue Nov 28, 2019 · 5 comments

Comments

@m4ce
Copy link

m4ce commented Nov 28, 2019

I recently upgraded from spdlog 1.3.1 to 1.4.2. It seems that since then my applications crash on shutdown leaving a core file. It seems it's trying to log but the sink is gone?

Would anyone know why this happens?

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f09fb77d837 in spdlog::async_logger::backend_sink_it_ (this=0x2799410, msg=...) at /usr/local/include/spdlog/async_logger-inl.h:63
63                      sink->log(msg);
[Current thread is 1 (Thread 0x7f09d1a07700 (LWP 58))]
(gdb)
(gdb) bt
#0  0x00007f09fb77d837 in spdlog::async_logger::backend_sink_it_ (this=0x2799410, msg=...) at /usr/local/include/spdlog/async_logger-inl.h:63
#1  0x00007f09fb77d6b9 in spdlog::details::thread_pool::process_next_msg_ (this=0x230d9d0) at /usr/local/include/spdlog/details/thread_pool-inl.h:103
#2  0x00007f09fb77d57a in spdlog::details::thread_pool::worker_loop_ (this=0x230d9d0) at /usr/local/include/spdlog/details/thread_pool-inl.h:84
#3  0x00007f09fb77d245 in spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}::operator()() const (__closure=0x2a026b8) at /usr/local/include/spdlog/details/thread_pool-inl.h:27
#4  0x00007f09fb7857c3 in std::__invoke_impl<void, spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}>(std::__invoke_other, spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<voi
d ()>)::{lambda()#1}&&) (__f=...) at /usr/local/include/c++/8.3.0/bits/invoke.h:60
#5  0x00007f09fb78416d in std::__invoke<spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}>(std::__invoke_result&&, (spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>):
:{lambda()#1}&&)...) (__fn=...) at /usr/local/include/c++/8.3.0/bits/invoke.h:95
@zh1an
Copy link

zh1an commented Nov 28, 2019 via email

@m4ce
Copy link
Author

m4ce commented Nov 28, 2019

No - I don't do that. Should I? I see it's only an issue on windows (https://github.com/gabime/spdlog/wiki/6.-Asynchronous-logging) that leads to a deadlock. But here it's really a segfault..

@zh1an
Copy link

zh1an commented Nov 28, 2019

Sorry, I didn't notice gcc compiler.

@zh1an
Copy link

zh1an commented Nov 28, 2019

Can you provide your test code?

@m4ce
Copy link
Author

m4ce commented Nov 28, 2019

@zh1an, eventually I found the issue. It has nothing to do with spdlog. I was clearing a buffer on shutdown but boost asio was still holding on to that and moving it. The thing is that the error was too generic and misleading. At some point, I even got errors like:

Fatal error: glibc detected an invalid stdio handle
Segmentation fault

or

Program terminated with signal SIGSEGV, Segmentation fault.
#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:499
499     ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
[Current thread is 1 (Thread 0x7fcc15535740 (LWP 629))]
(gdb) bt
#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:499

So that led me to think that it wasn't a spdlog issue..

@m4ce m4ce closed this as completed Nov 28, 2019
bachittle pushed a commit to bachittle/spdlog that referenced this issue Dec 22, 2022
Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants