async_connect挂在socket_ops :: accept在socket_select_interrupter :: open_descriptors中

时间:2014-10-05 14:49:59

标签: boost-asio

运行多个套接字的客户端 - 服务器应用程序的清晰一面在负载下挂起。 Analysis显示挂在async_connect上的一个通信线程,其中包含以下堆栈跟踪:

ntdll.dll!ZwWaitForSingleObject()  + 0xa bytes  
mswsock.dll!SockWaitForSingleObject()  + 0x13c bytes    
mswsock.dll!WSPAccept()  + 0x2a3a bytes 
ws2_32.dll!WSAAccept()  + 0xaf bytes    
ws2_32.dll!accept()  + 0x12 bytes   
boost::asio::detail::socket_select_interrupter::open_descriptors()  Line 88 + 0x31 bytes    C++
boost::asio::detail::select_reactor::select_reactor(boost::asio::io_service & io_service={...})  Line 47 + 0x90 bytes   C++
boost::asio::detail::service_registry::create<boost::asio::detail::select_reactor>(boost::asio::io_service & owner={...})  Line 81 + 0x1f bytes C++
boost::asio::detail::service_registry::do_use_service(const boost::asio::io_service::service::key & key={...}, boost::asio::io_service::service * (boost::asio::io_service &)* factory=0x0000000036cbdda8)  Line 123 + 0x6 bytes    C++
boost::asio::detail::win_iocp_socket_service_base::start_connect_op(boost::asio::detail::win_iocp_socket_service_base::base_implementation_type & impl={...}, boost::asio::detail::reactor_op * op=0x000000002b9cea30, const sockaddr * addr=0x000000002870f5f0, unsigned __int64 addrlen=16)  Line 550 + 0x45 bytes    C++
boost::asio::detail::win_iocp_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::mf1<void,Replication::PTCPChannel,boost::system::error_code const & __ptr64>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<Replication::PTCPChannel> >,boost::arg<1> > > > >(boost::asio::detail::win_iocp_socket_service<boost::asio::ip::tcp>::implementation_type & impl={...}, const boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> & peer_endpoint={...}, boost::asio::detail::wrapped_handler<boost::asio::io_service::strand,boost::_bi::bind_t<void,boost::_mfi::mf1<void,Replication::PTCPChannel,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<Replication::PTCPChannel> >,boost::arg<1> > > > * handler=0x000000002b9cea30)  Line 497  C++
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::mf1<void,Replication::PTCPChannel,boost::system::error_code const & __ptr64>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<Replication::PTCPChannel> >,boost::arg<1> > > > >(boost::asio::detail::win_iocp_socket_service<boost::asio::ip::tcp>::implementation_type & impl={...}, const boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> & peer_endpoint={...}, const boost::asio::detail::wrapped_handler<boost::asio::io_service::strand,boost::_bi::bind_t<void,boost::_mfi::mf1<void,Replication::PTCPChannel,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<Replication::PTCPChannel> >,boost::arg<1> > > > & handler={...})  Line 209   C++
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::mf1<void,Replication::PTCPChannel,boost::system::error_code const & __ptr64>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<Replication::PTCPChannel> >,boost::arg<1> > > > >(const boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> & peer_endpoint={...}, const boost::asio::detail::wrapped_handler<boost::asio::io_service::strand,boost::_bi::bind_t<void,boost::_mfi::mf1<void,Replication::PTCPChannel,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<Replication::PTCPChannel> >,boost::arg<1> > > > & handler={...})  Line 723    C++

任何人都可以建议为什么内部插座连接挂起?挂起发生在负载测试几个小时后,最终会阻塞整个应用程序。 由于这是一个内部套接字(监听环回IP),任何人都可以解释谁应该连接到它以及何时连接?是否有某种内部限制可以通过asio套接字服务连接到环回端口的数量?

在这种情况下,是否有一种首选方法可以关闭悬挂线程?

有问题的应用程序是目前在Win2k8R2或Win 2k12 R2上运行的Windows应用程序,使用的提升版本是1.54。

2 个答案:

答案 0 :(得分:0)

防火墙是否可能阻止与目标端口的连接?这是in this bug report

提到的一种可能性

答案 1 :(得分:0)

寻找最大连接数(asp.net的出站限制为2)