Opened 7 years ago

Last modified 6 years ago

#12122 new Bugs

Socket get_option throwing length_error exceptions

Reported by: Chris White <chriswhitemsu@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:

Description

We've seen some indeterminate behavior when calling get_option(no_delay). Occasionally we'll see the length_error exception get thrown from within socket_option::boolean::resize() even though we're passing in an error_code to get_option(). Occasionally we'll get an unexpected result from the option as well (the option will be off even though it was set to on). We'll manually add more details to the exception in question so we can investigate what unexpected size the resize() function is encountering. Also, I noticed it's not the first time this exception was encountered by someone:

https://sourceforge.net/p/asio/mailman/message/6494499/

A few things should really happen here regardless of the root issue:

  1. An exception should not be thrown when an error_code is passed in. These resize() functions need support for error_code so it can be passed through by the corresponding get_option() overload.
  1. The exception message in resize() should contain more details. In particular, it should mention the value of the passed in size 's', and possibly the result of the size() member function as well.

We've seen this happen on Windows v6.0.6002 and v6.1.7601. We'll add more details here about the unexpected size value we're encountering once we have them.

Change History (1)

comment:1 by Chris White <chriswhitemsu@…>, 6 years ago

We saw this happen with our more detailed exception message.

socket_option::boolean::resize() was called with s = 0.

socket_option::boolean::size() returned 4 at that time.

Note: See TracTickets for help on using tickets.