Opened 5 years ago

Last modified 5 years ago

#13158 new Bugs

core dump when get parent_path in a new thread

Reported by: jaycelq@… Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

I will create a boost thread to delete some outdated files, and there is high possibility the program crash, when the program exit.

I got the issue like me, but not determined. I doubt it's reason of the static variable of locale. in groups.google.com/forum/#!topic/boost-list/HOyZxH8JJc4

                time_t del_time = cut_time - log_keep_time_ * 60;
                std::string del_path(file_path_);
                boost::thread del_thread(MiLogFile::removeExpiredLog, del_path, del_time);
                del_thread.detach();


        int MiLogFile::removeExpiredLog(std::string file_path, uint32_t expire_time)
        {
            boost::filesystem::path log_path(file_path);
            boost::filesystem::path dir = log_path.parent_path();
#3  0x00007fad7a9f4393 in __dynamic_cast () from /usr/lib64/libstdc++.so.6
#4  0x00007fad7a9d9fbb in std::codecvt<wchar_t, char, __mbstate_t> const& std::use_facet<std::codecvt<wchar_t, char, __mbstate_t> >(std::locale const&) () from /usr/lib64/libstdc++.so.6
#5  0x00007fad7ca415ad in boost::filesystem::path::parent_path() const () from ../../../..//ext//boost_1_56_0/stage/lib/libboost_filesystem.so.1.56.0
#6  0x00007fad7cc77ad0 in common::milog::MiLogFile::removeExpiredLog (file_path=..., expire_time=1502292035) at src/milog_file.cpp:361
#7  0x00007fad7cc7b706 in operator()<int, int (*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int), boost::_bi::list0> (a=..., f=<optimized out>, this=<optimized out>)
    at ../../../../..//ext//boost_1_56_0/boost/bind/bind.hpp:303
#8  operator() (this=<optimized out>) at ../../../../..//ext//boost_1_56_0/boost/bind/bind_template.hpp:20
#9  boost::detail::thread_data<boost::_bi::bind_t<int, int (*)(std::string, unsigned int), boost::_bi::list2<boost::_bi::value<char*>, boost::_bi::value<long> > > >::run (this=<optimized out>)
    at ../../../../..//ext//boost_1_56_0/boost/thread/detail/thread.hpp:115
#10 0x00007fad7e3d5e83 in thread_proxy () from ../../../..//ext//boost_1_56_0/stage/lib/libboost_thread.so.1.56.0
#11 0x00007fad79ef5aa1 in start_thread () from /lib64/libpthread.so.0
#12 0x00007fad7a1f3aad in clone () from /lib64/libc.so.6

Change History (1)

comment:1 by anonymous, 5 years ago

Component: Nonefilesystem
Owner: set to Beman Dawes
Note: See TracTickets for help on using tickets.