Project

General

Profile

Crash a program, when WMessageResources::hibernate()

Added by Ilya Staroverov over 7 years ago

In programm have a thread which receive message(boost::asio) from another program.

_web_ui::web_ui(const WEnvironment& env)

: WApplication(env)

{

tdGetMess = boost::thread(&web_ui::threadGetMess, this);

}

void web_ui::threadGetMess()

{

while(!fEnd)

{

msg = client_wrap::receive(sessId);;

WServer::instance()->post(sessId, funcParse);

}

}

_

If mesage receive in same time what call WMessageResources::hibernate() --- happen "Double free, Sig.Fault".

14937 243 errors in context 39 of 46:

14937 Invalid read of size 8

14937 at 0x5D90618: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_construct.h:102)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5E233DC: Wt::WMessageResources::hibernate() (stl_tree.h:860)

14937 by 0x5E219A3: Wt::WMessageResourceBundle::hibernate() (WMessageResourceBundle.C:90)

14937 by 0x5D58A24: Wt::WCombinedLocalizedStrings::hibernate() (WCombinedLocalizedStrings.C:95)

14937 by 0x607CCD7: Wt::WebSession::Handler::~Handler() (WebSession.C:1042)

14937 by 0x60650D6: Wt::WebController::handleApplicationEvent(Wt::ApplicationEvent const&) (WebController.C:538)

14937 by 0x5DDC566: boost::asio::detail::completion_handler<boost::function<void ()> >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation, boost::system::error_code const&, unsigned long) (function_template.hpp:767)

14937 by 0x5DD9604: boost::asio::detail::strand_service::do_complete(boost::asio::detail::task_io_service
, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) (task_io_service_operation.hpp:37)

14937 by 0x5DDA84E: boost::asio::detail::task_io_service::run(boost::system::error_code&) (task_io_service_operation.hpp:37)

14937 by 0x5DD66EB: Wt::WIOService::run() (io_service.ipp:59)

14937 by 0x52E1A49: thread_proxy (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0)

14937 by 0x5705181: start_thread (pthread_create.c:312)

14937 by 0x74FA47C: clone (clone.S:111)

14937 Address 0xc3ef6f8 is 40 bytes inside a block of size 64 free'd

14937 at 0x4C2C2BC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)

14937 by 0x5D9063D: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (new_allocator.h:110)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5D905EB: std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > >, std::_Select1st<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, std::vector<std::string, std::allocatorstd::string > > >*) (stl_tree.h:1125)

14937 by 0x5E233DC: Wt::WMessageResources::hibernate() (stl_tree.h:860)

14937 by 0x5E219A3: Wt::WMessageResourceBundle::hibernate() (WMessageResourceBundle.C:90)

14937 by 0x5D58A24: Wt::WCombinedLocalizedStrings::hibernate() (WCombinedLocalizedStrings.C:95)

14937 by 0x607CCD7: Wt::WebSession::Handler::~Handler() (WebSession.C:1042)

14937 by 0x60677F0: Wt::WebController::handleRequest(Wt::WebRequest*) (WebController.C:724)

14937 by 0x6AA0ABE: boost::asio::detail::completion_handler<boost::_bi::bind_t<void, boost::_mfi::mf1<void, Wt::WebController, Wt::WebRequest*, boost::_bi::list2<boost::_bi::value<Wt::WebController>, boost::_bi::value<http::server::HTTPRequest*> > > >::do_complete(boost::asio::detail::task_io_service, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) (mem_fn_template.hpp:165)

14937 by 0x5DDA84E: boost::asio::detail::task_io_service::run(boost::system::error_code&) (task_io_service_operation.hpp:37)

14937 by 0x5DD66EB: Wt::WIOService::run() (io_service.ipp:59)

14937 by 0x52E1A49: thread_proxy (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0)

14937 by 0x5705181: start_thread (pthread_create.c:312)

14937 by 0x74FA47C: clone (clone.S:111)

I am edited function, put mutex :

_class WT_API WMessageResources

{

...

boost::mutex mutexLock_;

}

void WMessageResources::hibernate()

{

boost::mutex::scoped_lock lock(mutexLock_);

if (!loadInMemory_) {

defaults*.map*.clear();

local*.map*.clear();

loaded_ = false;

}

}_

After that the programm ceased to crash.

Is this bug?? if not, where i made mistake??