Ticket #2953 (closed Bugs: fixed)

Opened 5 years ago

Last modified 5 years ago

send_operation::perform does not consume buffer on would_block

Reported by: Dustin Spicuzza <dustin@…> Owned by: chris_kohlhoff
Milestone: Boost 1.39.0 Component: asio
Version: Boost 1.38.0 Severity: Showstopper
Keywords: vxworks asio Cc:


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.

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:

if (ec == boost::asio::error::would_block
    || ec == boost::asio::error::try_again)
    if (bytes > 0) buffers_.consume(bytes);
    return false;

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.

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).

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.

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.

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. :)


Change History

comment:1 Changed 5 years ago by chris_kohlhoff

  • Status changed from new to closed
  • Resolution set to fixed

(In [52465]) POSIX allows successful system calls to modify errno, so always clear the error_code if the result indicates success. Fixes #2953.

comment:2 Changed 5 years ago by chris_kohlhoff

(In [52494]) Merged revisions 52465,52478 from trunk


r52465 | chris_kohlhoff | 2009-04-18 23:27:53 +1000 (Sat, 18 Apr 2009) | 3 lines

POSIX allows successful system calls to modify errno, so always clear the error_code if the result indicates success. Fixes #2953.


r52478 | chris_kohlhoff | 2009-04-19 14:15:17 +1000 (Sun, 19 Apr 2009) | 3 lines

Don't include termios.h unless BOOST_ASIO_HAS_SERIAL_PORT is defined. Fixes #2917.



Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.