Discussion:
[asio-users] async_connect throws exception
Yuri Timenkov
2011-08-22 09:56:34 UTC
Permalink
Hi everyone,

It seems that asio doesn't follow it's exception guarantees. I can't find
explicit mention that async_* functions are no-throw but I think that it's
reasonable to assume that they report all errors via completion handler,
rather than throwing boost::system_error exception (as sync functions do).
The call stack is:
kernel32!RaiseException+0x58
msvcr100!_CxxThrowException+0x48
IpUtil!boost::throw_exception<boost::system::system_error>+0x5a
IpUtil!boost::asio::detail::do_throw_error+0x6d
IpUtil!boost::asio::detail::socket_select_interrupter::socket_select_interrupter+0x257
IpUtil!boost::asio::detail::select_reactor::select_reactor+0x9a
IpUtil!boost::asio::detail::service_registry::create<boost::asio::detail::select_reactor>+0x49
IpUtil!boost::asio::detail::service_registry::do_use_service+0x97
IpUtil!boost::asio::detail::win_iocp_socket_service_base::start_connect_op+0x3c
IpUtil!boost::asio::detail::win_iocp_socket_service<boost::asio::ip::tcp>::async_connect<>+0xd2
IpUtil!boost::asio::basic_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp>
::async_connect<>+0x106
and error code is 10048 (WSAEADDRINUSE), returned from socket_ops::connect.
I can't imagine reason when connect could return this error, may be there
were too many connections (thousands).

Does anybody know when such error may appear and how to better work-around
current asio behavior (boost 1.45)?

Thanks,
Yuri

Loading...