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

coredump when no space left in disk #2972

Closed
zRegle opened this issue Jan 8, 2024 · 5 comments
Closed

coredump when no space left in disk #2972

zRegle opened this issue Jan 8, 2024 · 5 comments

Comments

@zRegle
Copy link

zRegle commented Jan 8, 2024

Base on spdlog 1.5.0, I develop my own spdlog, called yotta_spdlog

When the disk is full, my program always crash at the file_helper.

Here is the cordump stack

#0  0x00007fc7c10ab6e4 in fwrite () from /lib64/libc.so.6
#1  0x0000000000bfad66 in yotta_spdlog::details::file_helper::write (this=this@entry=0x54dd588, buf=...)
    at /data/landun/workspace/deps/utils/logger/spdlog/user/../details/file_helper-inl.h:76
#2  0x0000000000c28eb2 in LogMetricSink::sink_it_ (this=0x54dd4e0, msg=...)
    at /data/landun/workspace/deps/utils/logger/spdlog/user/metric_sink.h:50
#3  0x0000000000bf345a in yotta_spdlog::sinks::base_sink<std::mutex>::log (this=0x54dd4e0, msg=...)
    at /data/landun/workspace/deps/utils/logger/spdlog/user/../sinks/base_sink-inl.h:29
#4  0x0000000000bf8b49 in yotta_spdlog::async_logger::backend_sink_it_ (this=0x54de2f0, msg=...)
    at /data/landun/workspace/deps/utils/logger/spdlog/./async_logger-inl.h:62
#5  0x0000000000bf98a1 in yotta_spdlog::details::thread_pool::process_next_msg_ (this=this@entry=0x54dd6a0)
    at /data/landun/workspace/deps/utils/logger/spdlog/././details/thread_pool-inl.h:103
#6  0x0000000000bf9ae8 in yotta_spdlog::details::thread_pool::worker_loop_ (this=0x54dd6a0)
    at /data/landun/workspace/deps/utils/logger/spdlog/././details/thread_pool-inl.h:85
#7  yotta_spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}::operator()() const (
    __closure=<optimized out>) at /data/landun/workspace/deps/utils/logger/spdlog/././details/thread_pool-inl.h:28
#8  std::__invoke_impl<void, yotta_spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}>(std::__invoke_other, yotta_spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}&&) (
    __f=...) at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/invoke.h:60
#9  std::__invoke<yotta_spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}>(yotta_spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}&&) (__fn=...)
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/invoke.h:95
#10 std::thread::_Invoker<std::tuple<yotta_spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=<optimized out>) at /opt/rh/devtoolset-7/root/usr/include/c++/7/thread:234
#11 std::thread::_Invoker<std::tuple<yotta_spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}> >::operator()() (this=<optimized out>) at /opt/rh/devtoolset-7/root/usr/include/c++/7/thread:243
#12 std::thread::_State_impl<std::thread::_Invoker<std::tuple<yotta_spdlog::details::thread_pool::thread_pool(unsigned long, unsigned long, std::function<void ()>)::{lambda()#1}> > >::_M_run() (this=<optimized out>) at /opt/rh/devtoolset-7/root/usr/include/c++/7/thread:186
#13 0x00000000017bc42f in execute_native_thread_routine ()
#14 0x00007fc7c247eea5 in start_thread () from /lib64/libpthread.so.0
#15 0x00007fc7c113a9fd in clone () from /lib64/libc.so.6
(gdb) f 1
#1  0x0000000000bfad66 in yotta_spdlog::details::file_helper::write (this=this@entry=0x54dd588, buf=...)
    at /data/landun/workspace/deps/utils/logger/spdlog/user/../details/file_helper-inl.h:76
76      /data/landun/workspace/deps/utils/logger/spdlog/user/../details/file_helper-inl.h: No such file or directory.
(gdb) p fd_
$1 = (FILE *) 0x0

It turns out that the fd_ is nullptr and it crashed.

I'm sure that I do not change any codes in this class. Can anyone help me to debug this? Thx in advance!

spdlog version: 1.5.0

@tt4g
Copy link
Contributor

tt4g commented Jan 8, 2024

This is expected behavior since file_helper fails to fopen_s() when the disk is full.
Since disk full is not a problem that can be solved by the application, spdlog does nothing.

@zRegle
Copy link
Author

zRegle commented Jan 8, 2024

This is expected behavior since file_helper fails to fopen_s() when the disk is full. Since disk full is not a problem that can be solved by the application, spdlog does nothing.

Never mind, I just made a stupid mistake.

But according to your reply, when the disk is full, spdlog will crash?(correct me if I'm wrong)

Thx for you help!

@tt4g
Copy link
Contributor

tt4g commented Jan 8, 2024

But according to your reply, when the disk is full, spdlog will crash?(correct me if I'm wrong)

Yes.

@gabime
Copy link
Owner

gabime commented Jan 8, 2024

It will not crash. It will throw an exception. Could it be that this exception was ignored by your app

@zRegle
Copy link
Author

zRegle commented Jan 8, 2024

thx for your help!

@zRegle zRegle closed this as completed Jan 8, 2024
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

3 participants