|
From: Jorge M. <jor...@gm...> - 2010-05-13 03:51:50
|
>>> >>> Why did you post this in reply to a message about std::locale::locale() ? >>> As far as I can see the race reported on the std::string object and the race >>> reported on std::locale::locale() are unrelated. >>> >>> Oops, my fault... >> Indeed, a reproducer for a std::locale::locale() would be nice. I haven't >> seen it so far... >> > > No problem. Regarding the race on the std::string refcount: this race is a > really annoying one. According to the information in > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518 this issue has been fixed > in both gcc 4.4.4 and gcc 4.5.0. The output I get with Valgrind r11128 > (trunk) and gcc 4.4.4 (which included libstdc++ version 6.0.13) confirms > this: > I still have not been able to write a small test case that will reproduce my race conditions. For what is worth, these are the relevant parts of the drd log for one of the race conditions. Everything that is not in namespaces std or boost is mine. I am using boost 1.42 and gcc 4.4.4 on debian. ==28087== Thread 9: ==28087== Conflicting store by thread 9 at 0x10cf9e8d size 1 ==28087== at 0x6E587AA: std::string::operator+=(char) (in /usr/lib/libstdc++.so.6.0.13) ==28087== by 0x9E3016: boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::m_append(char) (path.hpp:1108) ==28087== by 0x9E0BB5: boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::operator/=(char const*) (path.hpp:1128) ==28087== by 0x9DDAE1: boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::basic_path(char const*) (path.hpp:167) ==28087== by 0xA562ED: ripe_server::request_parser::consume(ripe_server::request&, char) (request_parser.cpp:29) ==28087== by 0x9F266F: boost::tuples::tuple<boost::logic::tribool, char*, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> ripe_server::request_parser::parse<char*>(ripe_server::request&, char*, char*) (request_parser.hpp:45) ==28087== by 0x9EF523: ripe_server::connection::handle_read(boost::system::error_code const&, unsigned long) (connection.cpp:50) ==28087== by 0xA04532: void boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>::call<boost::shared_ptr<ripe_server::connection>, boost::system::error_code const, unsigned long>(boost::shared_ptr<ripe_server::connection>&, void const*, boost::system::error_code const&, unsigned long&) const (mem_fn_template.hpp:271) ==28087== by 0xA041EA: void boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>::operator()<boost::shared_ptr<ripe_server::connection> >(boost::shared_ptr<ripe_server::connection>&, boost::system::error_code const&, unsigned long) const (mem_fn_template.hpp:286) ==28087== by 0xA045B5: void boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()>::operator()<boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list2<boost::system::error_code&, unsigned long&> >(boost::_bi::type<void>, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>&, boost::_bi::list2<boost::system::error_code&, unsigned long&>&, int) (bind.hpp:392) ==28087== by 0xA042C3: void boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >::operator()<boost::system::error_code, unsigned long>(boost::system::error_code&, unsigned long&) (bind_template.hpp:61) ==28087== by 0xA03EB4: boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long>::operator()() (bind_handler.hpp:96) ==28087== Address 0x10cf9e8d is at offset 61 from 0x10cf9e50. Allocation context: ==28087== at 0x4C24FD1: operator new(unsigned long) (vg_replace_malloc.c:261) ==28087== by 0x6E56B38: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.13) ==28087== by 0x6E57AFA: std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) (in /usr/lib/libstdc++.so.6.0.13) ==28087== by 0x6E5806B: std::string::reserve(unsigned long) (in /usr/lib/libstdc++.so.6.0.13) ==28087== by 0x6E5876D: std::string::operator+=(char) (in /usr/lib/libstdc++.so.6.0.13) ==28087== by 0x9E3016: boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::m_append(char) (path.hpp:1108) ==28087== by 0x9E0BB5: boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::operator/=(char const*) (path.hpp:1128) ==28087== by 0x9DDAE1: boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::basic_path(char const*) (path.hpp:167) ==28087== by 0xA562ED: ripe_server::request_parser::consume(ripe_server::request&, char) (request_parser.cpp:29) ==28087== by 0x9F266F: boost::tuples::tuple<boost::logic::tribool, char*, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> ripe_server::request_parser::parse<char*>(ripe_server::request&, char*, char*) (request_parser.hpp:45) ==28087== by 0x9EF523: ripe_server::connection::handle_read(boost::system::error_code const&, unsigned long) (connection.cpp:50) ==28087== by 0xA04532: void boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>::call<boost::shared_ptr<ripe_server::connection>, boost::system::error_code const, unsigned long>(boost::shared_ptr<ripe_server::connection>&, void const*, boost::system::error_code const&, unsigned long&) const (mem_fn_template.hpp:271) ==28087== Other segment start (thread 10) ==28087== at 0x4C2D283: pthread_mutex_lock (drd_pthread_intercepts.c:580) ==28087== by 0x6E1B21E: std::locale::locale() (in /usr/lib/libstdc++.so.6.0.13) ==28087== by 0x6E52B58: std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::basic_istringstream(std::string const&, std::_Ios_Openmode) (in /usr/lib/libstdc++.so.6.0.13) ==28087== by 0xA502EF: ripe_server::request_handler::handle_request(ripe_server::request&, ripe_server::reply&) (request_handler.cpp:221) ==28087== by 0x9EF634: ripe_server::connection::handle_read(boost::system::error_code const&, unsigned long) (connection.cpp:54) ==28087== by 0xA04532: void boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>::call<boost::shared_ptr<ripe_server::connection>, boost::system::error_code const, unsigned long>(boost::shared_ptr<ripe_server::connection>&, void const*, boost::system::error_code const&, unsigned long&) const (mem_fn_template.hpp:271) ==28087== by 0xA041EA: void boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>::operator()<boost::shared_ptr<ripe_server::connection> >(boost::shared_ptr<ripe_server::connection>&, boost::system::error_code const&, unsigned long) const (mem_fn_template.hpp:286) ==28087== by 0xA045B5: void boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()>::operator()<boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list2<boost::system::error_code&, unsigned long&> >(boost::_bi::type<void>, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>&, boost::_bi::list2<boost::system::error_code&, unsigned long&>&, int) (bind.hpp:392) ==28087== by 0xA042C3: void boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >::operator()<boost::system::error_code, unsigned long>(boost::system::error_code&, unsigned long&) (bind_template.hpp:61) ==28087== by 0xA03EB4: boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long>::operator()() (bind_handler.hpp:96) ==28087== by 0xA03BF7: void boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:62) ==28087== by 0xA0392A: void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >(boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >, boost::system::error_code, unsigned long> const&, boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >&) (handler_invoke_helpers.hpp:41) ==28087== Other segment end (thread 10) ==28087== at 0x4C2E46B: pthread_cond_wait@* (drd_pthread_intercepts.c:691) ==28087== by 0xA1281F: boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) (condition_variable.hpp:20) ==28087== by 0xA12D86: boost::shared_mutex::lock() (shared_mutex.hpp:135) ==28087== by 0xA1AA8F: boost::unique_lock<boost::shared_mutex>::lock() (locks.hpp:349) ==28087== by 0xA16378: boost::unique_lock<boost::shared_mutex>::unique_lock(boost::shared_mutex&) (locks.hpp:227) ==28087== by 0xA09C51: ripe_server::DatabaseAccessor::removeImages(std::vector<std::string, std::allocator<std::string> > const&) (DatabaseAccessor.cpp:174) ==28087== by 0xA50933: ripe_server::request_handler::handle_request(ripe_server::request&, ripe_server::reply&) (request_handler.cpp:230) ==28087== by 0x9EF634: ripe_server::connection::handle_read(boost::system::error_code const&, unsigned long) (connection.cpp:54) ==28087== by 0xA04532: void boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>::call<boost::shared_ptr<ripe_server::connection>, boost::system::error_code const, unsigned long>(boost::shared_ptr<ripe_server::connection>&, void const*, boost::system::error_code const&, unsigned long&) const (mem_fn_template.hpp:271) ==28087== by 0xA041EA: void boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>::operator()<boost::shared_ptr<ripe_server::connection> >(boost::shared_ptr<ripe_server::connection>&, boost::system::error_code const&, unsigned long) const (mem_fn_template.hpp:286) ==28087== by 0xA045B5: void boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()>::operator()<boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list2<boost::system::error_code&, unsigned long&> >(boost::_bi::type<void>, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>&, boost::_bi::list2<boost::system::error_code&, unsigned long&>&, int) (bind.hpp:392) ==28087== by 0xA042C3: void boost::_bi::bind_t<void, boost::_mfi::mf2<void, ripe_server::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<ripe_server::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> >::operator()<boost::system::error_code, unsigned long>(boost::system::error_code&, unsigned long&) (bind_template.hpp:61) ==28087== |