id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 8935,"async_write successful but only wrote 64K, handler invoked with bytes_transferred 0",wim@…,chris_kohlhoff,"Most of the time, everytime works perfect. Since boost 1.54 on Windows, I observed the following pattern in a minority of the cases (about 1 in 10 connections): - socket is open and in use, previous read-write sequences ok - async_write(103354 bytes, 4 buffers) - handle_async_write: 0 bytes written, The operation completed successfully - async_write(5 bytes, 3 buffers) - handle_async_write: 5 bytes written, The operation completed successfully What is not correct: - write handler is invoked with no error condition, but bytes_transferred set to 0 instead of the expected 103354 bytes - a packet sniffer shows that of the 103354 bytes, 65536 bytes were transferred, even though 0 was reported - the packet sniffer also shows that the 5 following bytes were transferred This corrupts the data stream. When I set a conditional breakpoint on the write handler, I see that the case where no error is reported but bytes_transferred != 0 happens much more regularly, but it does not seem to be problematic for writes of less than 64K. This is a stack trace of such an occurance (bytes_transferred is 0, e is 0): {{{ hello.wt.exe!http::server::Connection::handleWriteResponse(const boost::system::error_code & e, unsigned int bytes_transferred) Line 372 C++ hello.wt.exe!boost::_mfi::mf2::call,boost::system::error_code const ,unsigned int>(boost::shared_ptr & u, const void * __formal, const boost::system::error_code & b1, unsigned int & b2) Line 271 C++ hello.wt.exe!boost::_mfi::mf2::operator() >(boost::shared_ptr & u, const boost::system::error_code & a1, unsigned int a2) Line 287 C++ hello.wt.exe!boost::_bi::list3 >,boost::arg<1>,boost::arg<2> >::operator(),boost::_bi::list2 >(boost::_bi::type __formal, boost::_mfi::mf2 & f, boost::_bi::list2 & a, int __formal) Line 393 C++ hello.wt.exe!boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >::operator()(const boost::system::error_code & a1, const unsigned int & a2) Line 103 C++ hello.wt.exe!boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int>::operator()() Line 129 C++ hello.wt.exe!boost::asio::asio_handler_invoke,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> >(boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> function, ...) Line 65 C++ hello.wt.exe!boost_asio_handler_invoke_helpers::invoke,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > >(boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> & function, boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > & context) Line 37 C++ hello.wt.exe!boost::asio::detail::asio_handler_invoke,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int>(boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> & function, boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> * this_handler) Line 171 C++ hello.wt.exe!boost_asio_handler_invoke_helpers::invoke,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int>,boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> >(boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> & function, boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> & context) Line 37 C++ hello.wt.exe!boost::asio::detail::strand_service::dispatch,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> >(boost::asio::detail::strand_service::strand_impl * & impl, boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> & handler) Line 62 C++ hello.wt.exe!boost::asio::io_service::strand::dispatch,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> >(const boost::asio::detail::binder2,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::system::error_code,unsigned int> & handler) Line 157 C++ hello.wt.exe!boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running>::operator()(const boost::system::error_code & arg1, const unsigned int & arg2) Line 99 C++ > hello.wt.exe!boost::asio::detail::write_op >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >::operator()(const boost::system::error_code & ec, unsigned int bytes_transferred, int start) Line 194 C++ hello.wt.exe!boost::asio::detail::binder2 >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>::operator()() Line 129 C++ hello.wt.exe!boost::asio::detail::rewrapped_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > >::operator()() Line 192 C++ hello.wt.exe!boost::asio::asio_handler_invoke >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > >(boost::asio::detail::rewrapped_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > function, ...) Line 65 C++ hello.wt.exe!boost_asio_handler_invoke_helpers::invoke >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > >,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > >(boost::asio::detail::rewrapped_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > & function, boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > & context) Line 37 C++ hello.wt.exe!boost::asio::detail::asio_handler_invoke >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > >,boost::asio::detail::binder2 >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > >(boost::asio::detail::rewrapped_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > & function, boost::asio::detail::rewrapped_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > * this_handler) Line 276 C++ hello.wt.exe!boost_asio_handler_invoke_helpers::invoke >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > >,boost::asio::detail::rewrapped_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > >(boost::asio::detail::rewrapped_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > & function, boost::asio::detail::rewrapped_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > & context) Line 37 C++ hello.wt.exe!boost::asio::detail::completion_handler >,std::vector >,boost::asio::detail::transfer_all_t,boost::asio::detail::wrapped_handler,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > >,boost::asio::detail::is_continuation_if_running> >,boost::system::error_code,unsigned int>,boost::_bi::bind_t,boost::_bi::list3 >,boost::arg<1>,boost::arg<2> > > > >::do_complete(boost::asio::detail::win_iocp_io_service * owner, boost::asio::detail::win_iocp_operation * base, const boost::system::error_code & __formal, unsigned int __formal) Line 68 C++ hello.wt.exe!boost::asio::detail::win_iocp_operation::complete(boost::asio::detail::win_iocp_io_service & owner, const boost::system::error_code & ec, unsigned int bytes_transferred) Line 45 C++ hello.wt.exe!boost::asio::detail::strand_service::do_complete(boost::asio::detail::win_iocp_io_service * owner, boost::asio::detail::win_iocp_operation * base, const boost::system::error_code & ec, unsigned int __formal) Line 168 C++ hello.wt.exe!boost::asio::detail::win_iocp_operation::complete(boost::asio::detail::win_iocp_io_service & owner, const boost::system::error_code & ec, unsigned int bytes_transferred) Line 45 C++ hello.wt.exe!boost::asio::detail::win_iocp_io_service::do_one(bool block, boost::system::error_code & ec) Line 402 C++ hello.wt.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code & ec) Line 161 C++ hello.wt.exe!boost::asio::io_service::run() Line 59 C++ }}} I can reproduce this quite easily, please ask if you need more information. ",Bugs,closed,To Be Determined,asio,Boost 1.54.0,Problem,duplicate,,