Subject: [Boost-bugs] [Boost C++ Libraries] #2876: Windows: ip::tcp::socket does not clean up write jobs
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-03-20 07:13:05
#2876: Windows: ip::tcp::socket does not clean up write jobs
--------------------------------------------------------+-------------------
Reporter: Benjamin Carlyle <ben.carlyle_at_[hidden]> | Owner: chris_kohlhoff
Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: asio
Version: Boost 1.38.0 | Severity: Problem
Keywords: |
--------------------------------------------------------+-------------------
I believe I am getting both a confirmation of a write and a socket close
on the same event cycle on Windows. The test program I am reproducing this
in does the following:
1. Establish a connection over loop-back within a single process
2. Start an async_read on the client side
3. Close the connection from the server side
4. Perform an async_write on the client side
5. Run the io_service
My results are that:
1. The async_read handler is invoked with an error. Within this
handler I destroy the socket and release my write buffer.
2. Within the cleanup of the socket, no entries are found in the
write_op queue (I am explicitly calling close())
3. A short time later the program aborts during
boost::asio::detail::buffer_debug_check<std::vector>. It appears to be
referring to the vector I called clear on. A stack trace from Visual
Studio 2008 is included below. The key seems to be that the notification
of write completion is being processed after the notification of the
connection close and is already off the write_op queue when the read
handler that sees the close is invoked.
msvcp90d.dll!std::_Debug_message(const wchar_t *
message=0x00683e18, const wchar_t * file=0x0067c000, unsigned int line=98)
Line 24 C++
httpresource.exe!std::_Vector_const_iterator<char,std::allocator<char>
>::operator*() Line 98 + 0x14 bytes C++
httpresource.exe!std::_Vector_iterator<char,std::allocator<char>
>::operator*() Line 340 C++
httpresource.exe!boost::asio::detail::buffer_debug_check<std::_Vector_iterator<char,std::allocator<char>
> >::operator()() Line 446 C++
httpresource.exe!boost::detail::function::void_function_obj_invoker0<boost::asio::detail::buffer_debug_check<std::_Vector_iterator<char,std::allocator<char>
> >,void>::invoke(boost::detail::function::function_buffer &
function_obj_ptr={...}) Line 153 C++
httpresource.exe!boost::function0<void>::operator()() Line 989 +
0x13 bytes C++
httpresource.exe!boost::asio::detail::buffer_cast_helper(const
boost::asio::const_buffer & b={...}) Line 294 C++
httpresource.exe!boost::asio::buffer_cast<void const *>(const
boost::asio::const_buffer & b={...}) Line 311 + 0x9 bytes C++
httpresource.exe!boost::asio::buffer(const
boost::asio::const_buffer & b={...}, unsigned int max_size_in_bytes=65536)
Line 648 + 0x70 bytes C++
httpresource.exe!boost::asio::detail::consuming_buffers_iterator<boost::asio::const_buffer,boost::asio::mutable_buffer
const
*>::consuming_buffers_iterator<boost::asio::const_buffer,boost::asio::mutable_buffer
const *>(bool at_end=false, const boost::asio::const_buffer & first={...},
const boost::asio::mutable_buffer * begin_remainder=0x00bfc298, const
boost::asio::mutable_buffer * end_remainder=0x00bfc298, unsigned int
max_size=65536) Line 60 + 0x79 bytes C++
httpresource.exe!boost::asio::detail::consuming_buffers<boost::asio::const_buffer,boost::asio::mutable_buffers_1>::begin()
Line 163 + 0x2e bytes C++
>
httpresource.exe!boost::asio::detail::win_iocp_socket_service<boost::asio::ip::tcp>::send_operation<boost::asio::detail::consuming_buffers<boost::asio::const_buffer,boost::asio::mutable_buffers_1>,boost::asio::detail::write_handler<boost::asio::basic_stream_socket<boost::asio::ip::tcp,boost::asio::stream_socket_service<boost::asio::ip::tcp>
>,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t<void,boost::_mfi::mf2<void,FOX_HTTPResource,boost::system::error_code
const &,unsigned int>,boost::_bi::list3<boost::_bi::value<FOX_HTTPResource
*>,boost::arg<1>,boost::arg<2> > > >
>::do_completion_impl(boost::asio::detail::win_iocp_io_service::operation
* op=0x00bfc240, unsigned long last_error=0, unsigned int
bytes_transferred=37) Line 757 + 0xf bytes C++
httpresource.exe!boost::asio::detail::win_iocp_io_service::operation::do_completion(unsigned
long last_error=0, unsigned int bytes_transferred=37) Line 77 + 0x16
bytes C++
httpresource.exe!boost::asio::detail::win_iocp_io_service::do_one(bool
block=true, boost::system::error_code & ec={...}) Line 509 C++
httpresource.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code
& ec={...}) Line 186 + 0xe bytes C++
httpresource.exe!boost::asio::io_service::run() Line 58 + 0xf
bytes C++
httpresource.exe!main() Line 1072 C++
httpresource.exe!__tmainCRTStartup() Line 582 + 0x19 bytes C
httpresource.exe!mainCRTStartup() Line 399 C
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2876> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC