Boost C++ Libraries: Ticket #8669: boost::asio::windows::random_access_handle is seriously broken https://svn.boost.org/trac10/ticket/8669 <p> This year a new library called Boost.AFIO extending Boost.ASIO with async file i/o was given funding for Google Summer of Code. This library has found some serious problems with Boost.ASIO's Windows IOCP boost::asio::windows::random_access_handle implementation: </p> <ol><li>It appears to limit buffer sizes to 64Kb which corrupts output. This may be appropriate for non-random access e.g. network use (see <a class="ext-link" href="http://comments.gmane.org/gmane.comp.lib.boost.asio.user/3676"><span class="icon">​</span>http://comments.gmane.org/gmane.comp.lib.boost.asio.user/3676</a>), but it is a showstopper for file i/o. The windows::random_access_handle should have no such limitation. </li></ol><ol start="2"><li>It appears to corrupt output when many buffers are passed, even when each of these is under 64Kb. </li></ol><ol start="3"><li>It also doesn't appear to like doing scatter/gather file i/o from multiple threads. </li></ol><p> You will note that the POSIX (Linux) implementation doesn't have any of these problems (see <a class="ext-link" href="https://travis-ci.org/BoostGSoC/boost.afio/builds/7882496"><span class="icon">​</span>https://travis-ci.org/BoostGSoC/boost.afio/builds/7882496</a>). This is something wrong with the Windows IOCP implementation in Boost.ASIO. </p> <p> To illustrate the problem, I have created a special branch for this bug report at <a class="ext-link" href="https://github.com/ned14/TripleGit/tree/boost_asio_bug1"><span class="icon">​</span>https://github.com/ned14/TripleGit/tree/boost_asio_bug1</a>. If you examine <a class="ext-link" href="https://github.com/ned14/TripleGit/blob/boost_asio_bug1/unittests/main.cpp#L11"><span class="icon">​</span>https://github.com/ned14/TripleGit/blob/boost_asio_bug1/unittests/main.cpp#L11</a> you'll see that I've created a macro BOOST_ASIO_BUG_WORKAROUND which when defined gets the torture test to pass. If you run through main.cpp looking for BOOST_ASIO_BUG_WORKAROUND you'll see the changes I had to make to get things working - these are a good indicator of what's going wrong in Boost.ASIO I think. </p> <p> To run just the failing unit test which exhibits the problem, use "x64/Debug/tests async_io/torture". You'll need the experimental VS2012 Nov 2012 CTP compiler supporting variadic templates to compile the code successfully in Visual Studio 2012. </p> <p> My thanks in advance for your time. </p> <p> Niall </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8669 Trac 1.4.3 Niall Douglas Mon, 10 Jun 2013 15:40:22 GMT <link>https://svn.boost.org/trac10/ticket/8669#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8669#comment:1</guid> <description> <p> Sorry I was unclear with problem no 2: I suspect Boost.ASIO isn't incrementing in an atomic fashion (or at all) the Offset member of the OVERLAPPED structure during multi-buffer reads and writes. With sockets and pipes of course this would never have been necessary. </p> <p> Niall </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Niall Douglas</dc:creator> <pubDate>Tue, 13 Aug 2013 14:49:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8669#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8669#comment:2</guid> <description> <p> Bug <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8935" title="#8935: Bugs: async_write successful but only wrote 64K, handler invoked with ... (closed: duplicate)">#8935</a> may be related. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Mon, 05 May 2014 08:38:10 GMT</pubDate> <title>status, severity changed; resolution set https://svn.boost.org/trac10/ticket/8669#comment:3 https://svn.boost.org/trac10/ticket/8669#comment:3 <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> <li><strong>severity</strong> <span class="trac-field-old">Showstopper</span> → <span class="trac-field-new">Problem</span> </li> </ul> <p> In <a class="changeset" href="https://svn.boost.org/trac10/changeset/85750" title="Clarify that programs must not issue overlapping async_write_at ...">r85750</a>, added a note to clarify that programs must not issue concurrent async_write_at operations for overlapping regions. Included in boost 1.55. </p> Ticket