Boost logo

Boost :

Subject: [boost] [log] Segfault in "rotating_file" example
From: Jason (jasonr_at_[hidden])
Date: 2013-04-16 14:55:53


I'm working from SVN trunk revision 83923. I've been experiencing segfaults
when trying to set up a file sink that has date/time format specifiers in
its file name. I thought I was doing something wrong, but I found that the
"rotating_file" example also illustrates the same behavior. Here is a sample
backtrace:

#0 0x000000000077c0b8 in ?? ()
#1 0x0000000000415d25 in
boost::date_time::microsec_clock<boost::posix_time::ptime>::create_time
(converter=0x77c0b8)
    at /code/env/include/boost/date_time/microsec_time_clock.hpp:100
#2 0x00000000004d628b in boost::log::v2s_mt_posix::sinks::(anonymous
namespace)::date_and_time_formatter::operator()(std::string const&, unsigned
int) const [clone .isra.401]
    ()
#3 0x00000000004d639a in
boost::log::v2s_mt_posix::aux::light_function<std::string (unsigned
int)>::impl<boost::_bi::bind_t&lt;boost::_bi::unspecified,
boost::log::v2s_mt_posix::sinks::(anonymous
namespace)::date_and_time_formatter,
boost::_bi::list2&lt;boost::_bi::bind_t&lt;boost::_bi::unspecified,
boost::log::v2s_mt_posix::sinks::(anonymous
namespace)::file_counter_formatter,
boost::_bi::list2&lt;boost::_bi::value&lt;std::string>, boost::arg<1> > >,
boost::arg<1> > >
>::invoke_impl(boost::log::v2s_mt_posix::aux::light_function<std::string
(unsigned int)>::impl_base*, unsigned int) ()
#4 0x00000000004d3c90 in
boost::log::v2s_mt_posix::sinks::text_file_backend::consume(boost::log::v2s_mt_posix::record_view
const&, std::string const&) ()
#5 0x00000000004206c6 in
boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::feed_record<boost::log::v2s_mt_posix::aux::fake_mutex,
boost::log::v2s_mt_posix::sinks::text_file_backend>
(this=this_at_entry=0x783600, rec=..., backend_mutex=..., backend=...)
    at /code/env/include/boost/log/sinks/basic_sink_frontend.hpp:445
#6 0x000000000042082f in
boost::log::v2s_mt_posix::sinks::basic_formatting_sink_frontend<char>::try_feed_record<boost::mutex,
boost::log::v2s_mt_posix::sinks::text_file_backend> (this=0x783600, rec=...,
backend_mutex=..., backend=...) at
/code/env/include/boost/log/sinks/basic_sink_frontend.hpp:489
#7 0x00000000004c1475 in
boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)
()
#8 0x000000000040dff1 in push_record (this=<optimized out>, rec=...) at
/code/env/include/boost/log/core/core.hpp:308
#9 push_record_unlocked (rec=..., this=<optimized out>) at
/code/env/include/boost/log/sources/basic_logger.hpp:268
#10 push_record (rec=..., this=<optimized out>) at
/code/env/include/boost/log/sources/basic_logger.hpp:582
#11 ~record_pump (this=0x7fffffffddc0, __in_chrg=<optimized out>) at
/code/env/include/boost/log/sources/record_ostream.hpp:279
#12 main (argc=<optimized out>, argv=<optimized out>) at main.cpp:84

Looking at the disassembly of where the segfault happens, it seems to have
gone off the rails and is executing invalid code. Specifically, the function
pointer "converter" inside the date_time::microsec_clock<>:create_time()
function seems to be invalid. Any ideas? I'm using gcc 4.7.2 on Ubuntu
12.10.

Jason

--
View this message in context: http://boost.2283326.n4.nabble.com/log-Segfault-in-rotating-file-example-tp4645502.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk