Boost C++ Libraries: Ticket #2953: send_operation::perform does not consume buffer on would_block https://svn.boost.org/trac10/ticket/2953 <p> On at least some platforms (in particular, vxWorks), apparently when sendmsg is called it will transfer part of the buffer and set errno to EWOULDBLOCK. </p> <p> At boost/asio/detail/reactive_socket_service.hpp:651, the if statement statement should be changed to consume the buffer if there were bytes written. Like so: </p> <pre class="wiki">if (ec == boost::asio::error::would_block || ec == boost::asio::error::try_again) { if (bytes &gt; 0) buffers_.consume(bytes); return false; } </pre><p> I was not able to get my Windows machine (using BOOST_ASIO_DISABLE_IOCP) to return a would_block error, so I cannot say whether this is true for all platforms (can you think of a way to possibly provoke this behavior on another platform?). It seems like it would be a safe enough change to make however. </p> <p> Do you know if this is standard behavior, or is vxWorks breaking the rules here (though, its network stack is based off the BSD 4.4 stack so this probably affects BSD platforms also). </p> <p> I would imagine that this happens for other calls that check for would_block in the same file (there are a number of them), so those may need to be changed also. </p> <p> I was using the asio http server example 1 to provoke this bug. The resulting behavior is that the server keeps transmitting the same data buffer over and over and over... amusingly, I had modified the server to use persistent connections, so it would transmit hundreds of megabytes when a 50kb file was requested. I changed to the unmodified example code and I got the same behavior. </p> <p> There are a number of other things that asio needs to compile/run on vxWorks properly, but I'll file a separate bug for those once I clean that up. :) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2953 Trac 1.4.3 chris_kohlhoff Sat, 18 Apr 2009 13:27:58 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2953#comment:1 https://svn.boost.org/trac10/ticket/2953#comment:1 <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/52465" title="POSIX allows successful system calls to modify errno, so always clear ...">[52465]</a>) POSIX allows successful system calls to modify errno, so always clear the error_code if the result indicates success. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2953" title="#2953: Bugs: send_operation::perform does not consume buffer on would_block (closed: fixed)">#2953</a>. </p> Ticket chris_kohlhoff Sun, 19 Apr 2009 23:00:37 GMT <link>https://svn.boost.org/trac10/ticket/2953#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2953#comment:2</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/52494" title="Merged revisions 52465,52478 from trunk ........ r52465 | ...">[52494]</a>) Merged revisions 52465,52478 from trunk </p> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/52465" title="POSIX allows successful system calls to modify errno, so always clear ...">r52465</a> | chris_kohlhoff | 2009-04-18 23:27:53 +1000 (Sat, 18 Apr 2009) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> POSIX allows successful system calls to modify errno, so always clear the error_code if the result indicates success. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2953" title="#2953: Bugs: send_operation::perform does not consume buffer on would_block (closed: fixed)">#2953</a>. </p> </blockquote> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/52478" title="Don't include termios.h unless BOOST_ASIO_HAS_SERIAL_PORT is defined. ...">r52478</a> | chris_kohlhoff | 2009-04-19 14:15:17 +1000 (Sun, 19 Apr 2009) | 3 lines </p> </blockquote> <p> </p> <blockquote> <p> Don't include termios.h unless BOOST_ASIO_HAS_SERIAL_PORT is defined. Fixes <a class="reopened ticket" href="https://svn.boost.org/trac10/ticket/2917" title="#2917: Library Submissions: BOOST_ASIO_DISABLE_SERIAL_PORT doesn't work as expected (reopened)">#2917</a>. </p> </blockquote> <p> ........ </p> </description> <category>Ticket</category> </item> </channel> </rss>