Opened 13 years ago

Closed 13 years ago

#4023 closed Bugs (fixed)

Read handler has EOF error_code

Reported by: olafvdspek@… Owned by: chris_kohlhoff
Milestone: Boost 1.43.0 Component: asio
Version: Boost 1.42.0 Severity: Showstopper
Keywords: Cc:

Description

Hi,

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.

void connection::start()
{
	asio::async_read(socket_, asio::buffer(buffer_.begin(), 8), boost::bind(&connection::handle_read0, shared_from_this(), asio::placeholders::error));
}

void connection::handle_read0(const boost::system::error_code& e)
{
	if (e)
	{
		std::cerr << e.message() << std::endl;
		// return;
	}
	asio::async_read(socket_, asio::buffer(&buffer_[8], read_int(2, &buffer_[4]) + buffer_[6]), boost::bind(&connection::handle_read1, shared_from_this(), asio::placeholders::error));
}

void connection::handle_read1(const boost::system::error_code& e)
{
	if (e)
	{
		std::cerr << e.message() << std::endl;
		// return;
	}

Change History (12)

comment:1 by chris_kohlhoff, 13 years ago

Which platform, compiler, etc?

Can you test against the trunk?

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?

comment:2 by anonymous, 13 years ago

Windows Vista, VC9

Boost trunk? I'll have a look.

I can write a test program if that's really necessary.

XCC WOL Web Server.exe!connection::handle_read1(const boost::system::error_code & e={...}) Line 80 C++ XCC WOL Web Server.exe!boost::_mfi::mf1<void,connection,boost::system::error_code const &>::call<boost::shared_ptr<connection>,boost::system::error_code const >(boost::shared_ptr<connection> & u={...}, const void * formal=0x00000000, const boost::system::error_code & b1={...}) Line 156 + 0x21 bytes C++ XCC WOL Web Server.exe!boost::_mfi::mf1<void,connection,boost::system::error_code const &>::operator()<boost::shared_ptr<connection> >(boost::shared_ptr<connection> & u={...}, const boost::system::error_code & a1={...}) Line 172 C++ XCC WOL Web Server.exe!boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> >::operator()<boost::_mfi::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::system::error_code const &,unsigned int &> >(boost::_bi::type<void> formal={...}, boost::_mfi::mf1<void,connection,boost::system::error_code const &> & f={...}, boost::_bi::list2<boost::system::error_code const &,unsigned int &> & a={...}, boost::_bi::type<void> formal={...}) Line 314 C++ XCC WOL Web Server.exe!boost::_bi::bind_t<void,boost::_mfi::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > >::operator()<boost::system::error_code,unsigned int>(const boost::system::error_code & a1={...}, unsigned int & a2=0) Line 77 C++ XCC WOL Web Server.exe!boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >::operator()(const boost::system::error_code & ec={...}, unsigned int bytes_transferred=0) Line 160 C++ XCC WOL Web Server.exe!boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int>::operator()() Line 97 C++ XCC WOL Web Server.exe!boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> >(boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> function={...}, ...) Line 63 C++ XCC WOL Web Server.exe!boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int>,boost::_bi::bind_t<void,boost::_mfi::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >(const boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> & function={...}, boost::_bi::bind_t<void,boost::_mfi::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > & context={...}) Line 41 + 0x2f bytes C++ XCC WOL Web Server.exe!boost::asio::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int>,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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >(const boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> & function={...}, boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > > * this_handler=0x0017ed68) Line 202 + 0x10 bytes C++ XCC WOL Web Server.exe!boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int>,boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > > >(const boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> & function={...}, boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > > & context={...}) Line 41 + 0x16 bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_socket_service<boost::asio::ip::tcp>::receive_operation<boost::asio::detail::consuming_buffers<boost::asio::mutable_buffer,boost::asio::mutable_buffers_1>,boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > > >::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 & ec={...}) Line 545 + 0x16 bytes C++ XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code & 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()

comment:3 by anonymous, 13 years ago

XCC WOL Web Server.exe!connection::handle_read1(const boost::system::error_code & e={...})  Line 80	C++
XCC WOL Web Server.exe!boost::_mfi::mf1<void,connection,boost::system::error_code const &>::call<boost::shared_ptr<connection>,boost::system::error_code const >(boost::shared_ptr<connection> & u={...}, const void * __formal=0x00000000, const boost::system::error_code & b1={...})  Line 156 + 0x21 bytes	C++
XCC WOL Web Server.exe!boost::_mfi::mf1<void,connection,boost::system::error_code const &>::operator()<boost::shared_ptr<connection> >(boost::shared_ptr<connection> & u={...}, const boost::system::error_code & a1={...})  Line 172	C++
XCC WOL Web Server.exe!boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> >::operator()<boost::_mfi::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::system::error_code const &,unsigned int &> >(boost::_bi::type<void> __formal={...}, boost::_mfi::mf1<void,connection,boost::system::error_code const &> & f={...}, boost::_bi::list2<boost::system::error_code const &,unsigned int &> & a={...}, boost::_bi::type<void> __formal={...})  Line 314	C++
XCC WOL Web Server.exe!boost::_bi::bind_t<void,boost::_mfi::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > >::operator()<boost::system::error_code,unsigned int>(const boost::system::error_code & a1={...}, unsigned int & a2=0)  Line 77	C++
XCC WOL Web Server.exe!boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >::operator()(const boost::system::error_code & ec={...}, unsigned int bytes_transferred=0)  Line 160	C++
XCC WOL Web Server.exe!boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int>::operator()()  Line 97	C++
XCC WOL Web Server.exe!boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> >(boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> function={...}, ...)  Line 63	C++
XCC WOL Web Server.exe!boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int>,boost::_bi::bind_t<void,boost::_mfi::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >(const boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> & function={...}, boost::_bi::bind_t<void,boost::_mfi::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > & context={...})  Line 41 + 0x2f bytes	C++
XCC WOL Web Server.exe!boost::asio::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int>,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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >(const boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> & function={...}, boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > > * this_handler=0x0017ed68)  Line 202 + 0x10 bytes	C++
XCC WOL Web Server.exe!boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int>,boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > > >(const boost::asio::detail::binder2<boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > >,boost::system::error_code,unsigned int> & function={...}, boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > > & context={...})  Line 41 + 0x16 bytes	C++
XCC WOL Web Server.exe!boost::asio::detail::win_iocp_socket_service<boost::asio::ip::tcp>::receive_operation<boost::asio::detail::consuming_buffers<boost::asio::mutable_buffer,boost::asio::mutable_buffers_1>,boost::asio::detail::read_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::mf1<void,connection,boost::system::error_code const &>,boost::_bi::list2<boost::_bi::value<boost::shared_ptr<connection> >,boost::arg<1> > > > >::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 & ec={...})  Line 545 + 0x16 bytes	C++
XCC WOL Web Server.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code & 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() 	

in reply to:  3 ; comment:4 by chris_kohlhoff, 13 years ago

The lines

Replying to anonymous:

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 & ec={...})  Line 545 + 0x16 bytes	C++

indicate that the values:

last_error = 0 bytes_transferred = 0

are the ones getting returned from the OS via GetQueuedCompletionStatus. So there's nothing in that particular call stack to indicate that the closure isn't genuine.

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?

in reply to:  4 comment:5 by chris_kohlhoff, 13 years ago

Replying to chris_kohlhoff:

For example, is it possible that the total_buffer_size is 0?

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.

comment:6 by anonymous, 13 years ago

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.

in reply to:  6 comment:7 by chris_kohlhoff, 13 years ago

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.

comment:8 by anonymous, 13 years ago

This one on line 1412 gets hit:

    // A request to receive 0 bytes on a stream socket is a no-op.
    if (impl.protocol_.type() == SOCK_STREAM && total_buffer_size == 0)
    {
      ptr.get()->on_immediate_completion(0, 0);
      ptr.release();
      return;
    }

in reply to:  8 comment:9 by chris_kohlhoff, 13 years ago

Exactly the one I suspected. I'm in the process of making a fix for that bug.

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.

comment:10 by anonymous, 13 years ago

Actually I am. Some FastCGI packets have an empty body.

comment:11 by chris_kohlhoff, 13 years ago

(In [60689]) Fix bug where 0-byte reads were incorrectly passing an eof error_code to the handler. Refs #4023.

comment:12 by chris_kohlhoff, 13 years ago

Resolution: fixed
Status: newclosed

(In [60741]) Merge from trunk.

........

r60681 | chris_kohlhoff | 2010-03-18 12:32:34 +1100 (Thu, 18 Mar 2010) | 3 lines

Define NOMINMAX for all Windows compilers, not just Cygwin. Users can define BOOST_ASIO_NO_NOMINMAX to suppress this definition. Fixes #3901.

........

r60687 | chris_kohlhoff | 2010-03-18 17:23:38 +1100 (Thu, 18 Mar 2010) | 4 lines

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.

........

r60689 | chris_kohlhoff | 2010-03-18 22:08:19 +1100 (Thu, 18 Mar 2010) | 2 lines

Fix bug where 0-byte reads were incorrectly passing an eof error_code to the handler. Fixes #4023.

........

r60705 | chris_kohlhoff | 2010-03-20 00:08:04 +1100 (Sat, 20 Mar 2010) | 3 lines

Fix epoll_reactor bug where cancelled operations would complete with a "success" error_code.

........

r60717 | chris_kohlhoff | 2010-03-20 10:23:28 +1100 (Sat, 20 Mar 2010) | 2 lines

More extensive read and write tests.

........

r60722 | chris_kohlhoff | 2010-03-20 10:57:50 +1100 (Sat, 20 Mar 2010) | 2 lines

WinCE doesn't provide InitializeCriticalSectionAndSpinCount.

........

r60723 | chris_kohlhoff | 2010-03-20 10:58:48 +1100 (Sat, 20 Mar 2010) | 2 lines

Fix cancellation.

........

r60725 | chris_kohlhoff | 2010-03-20 10:59:48 +1100 (Sat, 20 Mar 2010) | 3 lines

Use cancel() to avoid Windows behaviour where a connection is reset if the socket is closed while there is a pending read operation.

........

Note: See TracTickets for help on using tickets.