Boost C++ Libraries: Ticket #4023: Read handler has EOF error_code https://svn.boost.org/trac10/ticket/4023 <p> Hi, </p> <p> I've got the following code in a project. This used to work fine in the past. Now, error_code is EOF while Wireshark doesn't show any end of the TCP stream. With the returns commented, the app works fine. </p> <pre class="wiki">void connection::start() { asio::async_read(socket_, asio::buffer(buffer_.begin(), 8), boost::bind(&amp;connection::handle_read0, shared_from_this(), asio::placeholders::error)); } void connection::handle_read0(const boost::system::error_code&amp; e) { if (e) { std::cerr &lt;&lt; e.message() &lt;&lt; std::endl; // return; } asio::async_read(socket_, asio::buffer(&amp;buffer_[8], read_int(2, &amp;buffer_[4]) + buffer_[6]), boost::bind(&amp;connection::handle_read1, shared_from_this(), asio::placeholders::error)); } void connection::handle_read1(const boost::system::error_code&amp; e) { if (e) { std::cerr &lt;&lt; e.message() &lt;&lt; std::endl; // return; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4023 Trac 1.4.3 chris_kohlhoff Thu, 18 Mar 2010 00:09:13 GMT <link>https://svn.boost.org/trac10/ticket/4023#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:1</guid> <description> <p> Which platform, compiler, etc? </p> <p> Can you test against the trunk? </p> <p> Can you supply a small test program that shows the problem? Or, at least, supply more info like the full call stack at the point when the erroneous error_code is passed? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 18 Mar 2010 09:12:35 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:2</guid> <description> <p> Windows Vista, VC9 </p> <p> Boost trunk? I'll have a look. </p> <p> I can write a test program if that's really necessary. </p> <p> XCC WOL Web Server.exe!connection::handle_read1(const boost::system::error_code &amp; e={...}) Line 80 C++ XCC WOL Web Server.exe!boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;::call&lt;boost::shared_ptr&lt;connection&gt;,boost::system::error_code const &gt;(boost::shared_ptr&lt;connection&gt; &amp; u={...}, const void * <span class="underline">formal=0x00000000, const boost::system::error_code &amp; b1={...}) Line 156 + 0x21 bytes C++ XCC WOL Web Server.exe!boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;::operator()&lt;boost::shared_ptr&lt;connection&gt; &gt;(boost::shared_ptr&lt;connection&gt; &amp; u={...}, const boost::system::error_code &amp; a1={...}) Line 172 C++ XCC WOL Web Server.exe!boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt;::operator()&lt;boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::system::error_code const &amp;,unsigned int &amp;&gt; &gt;(boost::_bi::type&lt;void&gt; </span>formal={...}, boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt; &amp; f={...}, boost::_bi::list2&lt;boost::system::error_code const &amp;,unsigned int &amp;&gt; &amp; a={...}, boost::_bi::type&lt;void&gt; <span class="underline">formal={...}) Line 314 C++ XCC WOL Web Server.exe!boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt;::operator()&lt;boost::system::error_code,unsigned int&gt;(const boost::system::error_code &amp; a1={...}, unsigned int &amp; a2=0) Line 77 C++ XCC WOL Web Server.exe!boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;::operator()(const boost::system::error_code &amp; ec={...}, unsigned int bytes_transferred=0) Line 160 C++ XCC WOL Web Server.exe!boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt;::operator()() Line 97 C++ XCC WOL Web Server.exe!boost::asio::asio_handler_invoke&lt;boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; &gt;(boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; function={...}, ...) Line 63 C++ XCC WOL Web Server.exe!boost_asio_handler_invoke_helpers::invoke&lt;boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt;,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;(const boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; &amp; function={...}, boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &amp; context={...}) Line 41 + 0x2f bytes C++ XCC WOL Web Server.exe!boost::asio::detail::asio_handler_invoke&lt;boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt;,boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;(const boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; &amp; function={...}, boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt; * this_handler=0x0017ed68) Line 202 + 0x10 bytes C++ XCC WOL Web Server.exe!boost_asio_handler_invoke_helpers::invoke&lt;boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt;,boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt; &gt;(const boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; &amp; function={...}, boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt; &amp; context={...}) Line 41 + 0x16 bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_socket_service&lt;boost::asio::ip::tcp&gt;::receive_operation&lt;boost::asio::detail::consuming_buffers&lt;boost::asio::mutable_buffer,boost::asio::mutable_buffers_1&gt;,boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt; &gt;::do_completion_impl(boost::asio::detail::win_iocp_io_service::operation * op=0x0130d548, unsigned long last_error=0, unsigned int bytes_transferred=0) Line 1336 + 0x4a bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::operation::on_completion(unsigned long last_error=0, unsigned long bytes_transferred=0) Line 114 + 0x1c bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::do_one(bool block=true, boost::system::error_code &amp; ec={...}) Line 545 + 0x16 bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code &amp; ec={...}) Line 229 + 0xe bytes C++ XCC WOL Web Server.exe!boost::asio::io_service::run() Line 68 + 0xf bytes C++ XCC WOL Web Server.exe!main(int argc=1, char * * argv=0x011d5d70) Line 49 C++ XCC WOL Web Server.exe__tmainCRTStartup() Line 586 + 0x19 bytes C XCC WOL Web Server.exe!mainCRTStartup() Line 403 C kernel32.dll!761aeccb() [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] ntdll.dll!77a6d24d() ntdll.dll!77a6d45f() </span></p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 18 Mar 2010 09:13:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:3</guid> <description> <pre class="wiki">XCC WOL Web Server.exe!connection::handle_read1(const boost::system::error_code &amp; e={...}) Line 80 C++ XCC WOL Web Server.exe!boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;::call&lt;boost::shared_ptr&lt;connection&gt;,boost::system::error_code const &gt;(boost::shared_ptr&lt;connection&gt; &amp; u={...}, const void * __formal=0x00000000, const boost::system::error_code &amp; b1={...}) Line 156 + 0x21 bytes C++ XCC WOL Web Server.exe!boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;::operator()&lt;boost::shared_ptr&lt;connection&gt; &gt;(boost::shared_ptr&lt;connection&gt; &amp; u={...}, const boost::system::error_code &amp; a1={...}) Line 172 C++ XCC WOL Web Server.exe!boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt;::operator()&lt;boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::system::error_code const &amp;,unsigned int &amp;&gt; &gt;(boost::_bi::type&lt;void&gt; __formal={...}, boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt; &amp; f={...}, boost::_bi::list2&lt;boost::system::error_code const &amp;,unsigned int &amp;&gt; &amp; a={...}, boost::_bi::type&lt;void&gt; __formal={...}) Line 314 C++ XCC WOL Web Server.exe!boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt;::operator()&lt;boost::system::error_code,unsigned int&gt;(const boost::system::error_code &amp; a1={...}, unsigned int &amp; a2=0) Line 77 C++ XCC WOL Web Server.exe!boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;::operator()(const boost::system::error_code &amp; ec={...}, unsigned int bytes_transferred=0) Line 160 C++ XCC WOL Web Server.exe!boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt;::operator()() Line 97 C++ XCC WOL Web Server.exe!boost::asio::asio_handler_invoke&lt;boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; &gt;(boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; function={...}, ...) Line 63 C++ XCC WOL Web Server.exe!boost_asio_handler_invoke_helpers::invoke&lt;boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt;,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;(const boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; &amp; function={...}, boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &amp; context={...}) Line 41 + 0x2f bytes C++ XCC WOL Web Server.exe!boost::asio::detail::asio_handler_invoke&lt;boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt;,boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;(const boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; &amp; function={...}, boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt; * this_handler=0x0017ed68) Line 202 + 0x10 bytes C++ XCC WOL Web Server.exe!boost_asio_handler_invoke_helpers::invoke&lt;boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt;,boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt; &gt;(const boost::asio::detail::binder2&lt;boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt;,boost::system::error_code,unsigned int&gt; &amp; function={...}, boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt; &amp; context={...}) Line 41 + 0x16 bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_socket_service&lt;boost::asio::ip::tcp&gt;::receive_operation&lt;boost::asio::detail::consuming_buffers&lt;boost::asio::mutable_buffer,boost::asio::mutable_buffers_1&gt;,boost::asio::detail::read_handler&lt;boost::asio::basic_stream_socket&lt;boost::asio::ip::tcp,boost::asio::stream_socket_service&lt;boost::asio::ip::tcp&gt; &gt;,boost::asio::mutable_buffers_1,boost::asio::detail::transfer_all_t,boost::_bi::bind_t&lt;void,boost::_mfi::mf1&lt;void,connection,boost::system::error_code const &amp;&gt;,boost::_bi::list2&lt;boost::_bi::value&lt;boost::shared_ptr&lt;connection&gt; &gt;,boost::arg&lt;1&gt; &gt; &gt; &gt; &gt;::do_completion_impl(boost::asio::detail::win_iocp_io_service::operation * op=0x0130d548, unsigned long last_error=0, unsigned int bytes_transferred=0) Line 1336 + 0x4a bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::operation::on_completion(unsigned long last_error=0, unsigned long bytes_transferred=0) Line 114 + 0x1c bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::do_one(bool block=true, boost::system::error_code &amp; ec={...}) Line 545 + 0x16 bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code &amp; ec={...}) Line 229 + 0xe bytes C++ XCC WOL Web Server.exe!boost::asio::io_service::run() Line 68 + 0xf bytes C++ XCC WOL Web Server.exe!main(int argc=1, char * * argv=0x011d5d70) Line 49 C++ XCC WOL Web Server.exe!__tmainCRTStartup() Line 586 + 0x19 bytes C XCC WOL Web Server.exe!mainCRTStartup() Line 403 C kernel32.dll!761aeccb() [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] ntdll.dll!77a6d24d() ntdll.dll!77a6d45f() </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Thu, 18 Mar 2010 09:38:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:4</guid> <description> <p> The lines </p> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4023#comment:3" title="Comment 3">anonymous</a>: </p> <blockquote class="citation"> <pre class="wiki">XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::operation::on_completion(unsigned long last_error=0, unsigned long bytes_transferred=0) Line 114 + 0x1c bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::do_one(bool block=true, boost::system::error_code &amp; ec={...}) Line 545 + 0x16 bytes C++ </pre></blockquote> <p> indicate that the values: </p> <blockquote> <p> last_error = 0 bytes_transferred = 0 </p> </blockquote> <p> are the ones getting returned from the OS via <a class="missing wiki">GetQueuedCompletionStatus</a>. So there's nothing in that particular call stack to indicate that the closure isn't genuine. </p> <p> You'll need to check the point where the operation is being started. E.g. see async_receive() starting on line 1368 of win_iocp_socket_service.hpp. For example, is it possible that the total_buffer_size is 0? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Thu, 18 Mar 2010 09:53:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4023#comment:4" title="Comment 4">chris_kohlhoff</a>: </p> <blockquote class="citation"> <p> For example, is it possible that the total_buffer_size is 0? </p> </blockquote> <p> As I've just spotted a bug related to no-op handling of empty buffers, I'd say it's almost certain to be the case that total_buffer_size == 0. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 18 Mar 2010 10:04:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:6</guid> <description> <p> I'm not sure what you mean. I do one receive with a buffer of 8 bytes for a FastCGI header and then another receive with a buffer exactly large enough for the body. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Thu, 18 Mar 2010 10:17:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:7</guid> <description> <p> Try putting a breakpoint on each of the on_immediate_completion() calls in win_iocp_socket_service::async_receive() and see if they get hit. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 18 Mar 2010 10:27:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:8</guid> <description> <p> This one on line 1412 gets hit: </p> <pre class="wiki"> // A request to receive 0 bytes on a stream socket is a no-op. if (impl.protocol_.type() == SOCK_STREAM &amp;&amp; total_buffer_size == 0) { ptr.get()-&gt;on_immediate_completion(0, 0); ptr.release(); return; } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Thu, 18 Mar 2010 10:29:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:9</guid> <description> <p> Exactly the one I suspected. I'm in the process of making a fix for that bug. </p> <p> Since you're obviously not expecting a 0-byte read you should check up the call stack from that point to see why one is beig issued. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 18 Mar 2010 10:32:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:10</guid> <description> <p> Actually I am. Some FastCGI packets have an empty body. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Thu, 18 Mar 2010 11:08:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4023#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4023#comment:11</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/60689" title="Fix bug where 0-byte reads were incorrectly passing an eof error_code ...">[60689]</a>) Fix bug where 0-byte reads were incorrectly passing an eof error_code to the handler. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4023" title="#4023: Bugs: Read handler has EOF error_code (closed: fixed)">#4023</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Sun, 21 Mar 2010 09:39:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4023#comment:12 https://svn.boost.org/trac10/ticket/4023#comment:12 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/60741" title="Merge from trunk. ........ r60681 | chris_kohlhoff | 2010-03-18 ...">[60741]</a>) Merge from trunk. </p> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/60681" title="Define NOMINMAX for all Windows compilers, not just Cygwin. Users can ...">r60681</a> | chris_kohlhoff | 2010-03-18 12:32:34 +1100 (Thu, 18 Mar 2010) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Define NOMINMAX for all Windows compilers, not just Cygwin. Users can define BOOST_ASIO_NO_NOMINMAX to suppress this definition. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3901" title="#3901: Bugs: ASIO and macro min and max on Windows (closed: fixed)">#3901</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/60687" title="Use a bitmask type for the resolver flags, as per the TR2 proposal. ...">r60687</a> | chris_kohlhoff | 2010-03-18 17:23:38 +1100 (Thu, 18 Mar 2010) | 4 lines </p> </blockquote> <p> </p> <blockquote> <p> Use a bitmask type for the resolver flags, as per the TR2 proposal. This will prevent implicit conversion from int to flags, allowing the compiler to catch cases where users incorrectly pass a numeric port number as the service name. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/60689" title="Fix bug where 0-byte reads were incorrectly passing an eof error_code ...">r60689</a> | chris_kohlhoff | 2010-03-18 22:08:19 +1100 (Thu, 18 Mar 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix bug where 0-byte reads were incorrectly passing an eof error_code to the handler. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4023" title="#4023: Bugs: Read handler has EOF error_code (closed: fixed)">#4023</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/60705" title="Fix epoll_reactor bug where cancelled operations would complete with a ...">r60705</a> | chris_kohlhoff | 2010-03-20 00:08:04 +1100 (Sat, 20 Mar 2010) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix epoll_reactor bug where cancelled operations would complete with a "success" error_code. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/60717" title="More extensive read and write tests. ">r60717</a> | chris_kohlhoff | 2010-03-20 10:23:28 +1100 (Sat, 20 Mar 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> More extensive read and write tests. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/60722" title="WinCE doesn't provide InitializeCriticalSectionAndSpinCount. ">r60722</a> | chris_kohlhoff | 2010-03-20 10:57:50 +1100 (Sat, 20 Mar 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> WinCE doesn't provide <a class="missing wiki">InitializeCriticalSectionAndSpinCount</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/60723" title="Fix cancellation. ">r60723</a> | chris_kohlhoff | 2010-03-20 10:58:48 +1100 (Sat, 20 Mar 2010) | 2 lines </p> </blockquote> <p> </p> <blockquote> <p> Fix cancellation. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/60725" title="Use cancel() to avoid Windows behaviour where a connection is reset if ...">r60725</a> | chris_kohlhoff | 2010-03-20 10:59:48 +1100 (Sat, 20 Mar 2010) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Use cancel() to avoid Windows behaviour where a connection is reset if the socket is closed while there is a pending read operation. </p> </blockquote> <p> ........ </p> Ticket