Closed
Description
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
Metadata
Assignees
Labels
No labels