[boost][asio][1.50] helgrind error between ip::tcp::socket::async_connect & io_service::run ?
Hi friends, I'm getting helgrind errors using asio::ip::tcp::socket::async_connect while at the same time io_service::run is running in a thread pool. The reports is: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Possible data race during read of size 8 at 0x507bb50 by thread #6 ==13316== at 0xDDF1CC: boost::asio::detail::epoll_reactor::descriptor_state::perform_io(unsigned int) (epoll_reactor.ipp:610) ==13316== by 0xDDF355: boost::asio::detail::epoll_reactor::descriptor_state::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) (epoll_reactor.ipp:648) ==13316== by 0xD7CF93: boost::asio::detail::task_io_service_operation::complete(boost::asio::detail::task_io_service&, boost::system::error_code const&, unsigned long) (task_io_service_operation.hpp:37) ==13316== by 0xE17469: boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex>&, boost::asio::detail::task_io_service::thread_info&, boost::asio::detail::op_queue<boost::asio::detail::task_io_service_operation>&, boost::system::error_code const&) (task_io_service.ipp:394) ==13316== by 0xE1713B: boost::asio::detail::task_io_service::run(boost::system::error_code&) (task_io_service.ipp:146) ==13316== by 0xE176FC: boost::asio::*io_service::run*() (io_service.ipp:59) ==13316== by 0xF97421: Common::ServiceRunner::ServiceThread() (ServiceRunner.cpp:67) .... This *conflicts* with a previous write of size 8 by thread #9 ==13316== at 0xDDE5EF: boost::asio::detail::epoll_reactor::register_descriptor(int, boost::asio::detail::epoll_reactor::descriptor_state*&) (epoll_reactor.ipp:156) ==13316== by 0xE75C34: boost::asio::detail::reactive_socket_service_base::do_open(boost::asio::detail::reactive_socket_service_base::base_implementation_type&, int, int, int, boost::system::error_code&) (reactive_socket_service_base.ipp:152) ==13316== by 0xE7B6E2: boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::open(boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::implementation_type&, boost::asio::ip::tcp const&, boost::system::error_code&) (reactive_socket_service.hpp:106) ==13316== by 0xE79FF7: boost::asio::stream_socket_service<boost::asio::ip::tcp>::*open*(boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::implementation_type&, boost::asio::ip::tcp const&, boost::system::error_code&) (stream_socket_service.hpp:127) ==13316== by 0xE78904: void boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp>
::*async_connect*<boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, boost::_bi::bind_t<void, boost::_mfi::mf2<void, Common::Comms::TCPClient, boost::system::error_code const&, boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp> >, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<Common::Comms::TCPClient> , boost::arg<1> (*)(), boost::_bi::value<boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp>
(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, boost::_bi::bind_t<void, boost::_mfi::mf2<void, Common::Comms::TCPClient, boost::system::error_code const&, boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp> >, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<Common::Comms::TCPClient> , boost::arg<1> (*)(), boost::_bi::value<boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp> const&) (basic_socket.hpp:712) ==13316== by 0xE7376B: Common::Comms::TCPClient::HandleResolve(boost::system::error_code const&, boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp>) (TCPClient.cpp:297)
I found that async_connect is not real problem, but *opening a socket* is, when io_service::run is running. Is this problem known or someone can suggest me a workaround ? Many thanks in advance, Jinqiang ZHANG
participants (1)
-
Jinqiang Zhang