Ticket #8933 (closed Bugs: fixed)
on the windows platform async reads with multiple threads can produce random EOF errors
|Reported by:||Shane Powell <killerbee@…>||Owned by:||chris_kohlhoff|
|Milestone:||To Be Determined||Component:||asio|
After upgrading upgrading boost to 1.54.0 I started getting lots of eof errors out of some of my ASIO based applications that didn't make sense.
My applications use the single io_service with a thread pool pattern. When the thread pool contains more than one thread I started getting random eof errors whenever the network traffic started to get heavy.
Attached is an example program that can reproduce the problem.
The application built with boost 1.53.0 works fine. Built with boost 1.54.0 fails.
I have tried visual studio version 2008 and 2012 with the same results.
The client will error out on the read with a eof error.
I tracked the problem back to a posted IO completion event that was generated from a on_pending call. The event gets converted to eof because ::GetLastError? always returns '0' and the transferred bytes are always 'zero' from the on_pending call. Looking at the changes between boost asio v1.53.0 and v1.54.0 I spotted in asio\detail\impl\win_iocp_io_service.ipp that some PostQueuedCompletionStatus? calls where changed form passing 'overlapped_contains_result' to passing '0'. Changing them back to 'overlapped_contains_result' fixes the problem.
comment:21 Changed 4 years ago by chris_kohlhoff
- Status changed from new to closed
- Resolution set to fixed