Opened 7 years ago

Last modified 6 years ago

#11823 new Bugs

Exception safety problems in the epoll based implementation of async_accept

Reported by: Sorin Fetche <sorin.fetche@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.59.0 Severity: Problem
Keywords: exception safety Cc:

Description

The implementation of boost::asio::ip::tcp::acceptor::async_accept fails to handle memory allocation failures in certain conditions when using the epoll based reactor.

The attached program (test_program.zip) reproduces the failures. They reproduce with Boost 1.59 as well as 1.57 when run on a Linux machine (and using the epoll based implementation).

Examples of runs of the test program compiled with GCC 6.0 and Boost 1.59 can be found on the Wandbox online compiler (links in the attached wandbox.txt file).

Attached is also a patch with a tentative fix that highlights the two places that cause the test program to fail. Even though it was created against the code from Boost 1.57, it applies to the code from 1.59.

Attachments (4)

test_program.zip (5.8 KB ) - added by Sorin Fetche <sorin.fetche@…> 7 years ago.
boost_asio_epoll_accept_exception_safety.patch (2.5 KB ) - added by Sorin Fetche <sorin.fetche@…> 7 years ago.
wandbox.txt (225 bytes ) - added by Sorin Fetche <sorin.fetche@…> 7 years ago.
boost_asio_hash_map_exception_safety.patch (1.5 KB ) - added by Sorin Fetche <sorin.fetche@…> 6 years ago.

Download all attachments as: .zip

Change History (7)

by Sorin Fetche <sorin.fetche@…>, 7 years ago

Attachment: test_program.zip added

by Sorin Fetche <sorin.fetche@…>, 7 years ago

comment:1 by Sorin Fetche <sorin.fetche@…>, 7 years ago

Component: Noneasio
Owner: set to chris_kohlhoff

comment:2 by Sorin Fetche <sorin.fetche@…>, 7 years ago

Links to the runs on Wandbox. The runs have different starting counters to the first memory allocation failure.

melpon.org/wandbox/permlink/OOUN9sKpEsLW0dUj

melpon.org/wandbox/permlink/ZBvpHRLx5pjdEb5N

melpon.org/wandbox/permlink/uZtkMz3Nl0rG8mb1

by Sorin Fetche <sorin.fetche@…>, 7 years ago

Attachment: wandbox.txt added

comment:3 by Sorin Fetche <sorin.fetche@…>, 6 years ago

The test program shows an exception problem in detail/hash_map.hpp too, if run on Windows with BOOST_ASIO_DISABLE_IOCP defined. Patch showing a possible fix of the problem on top of Boost 1.60 attached.

by Sorin Fetche <sorin.fetche@…>, 6 years ago

Note: See TracTickets for help on using tickets.