Ticket #3702 (closed Bugs: fixed)

Opened 7 years ago

Last modified 6 years ago

asio & ssl - leaking io_handlers after boost::asio::io_service object is stopped and destroyed

Reported by: tianhao.qiu@… Owned by: chris_kohlhoff
Milestone: Boost 1.42.0 Component: asio
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:


The way boost::asio::ssl::detail::openssl_stream_service is implemented requires that function handler_impl() has to be called before io_handler objects can be deleted. However when the io_service object is stopped and later destroyed, the handlers for those pending SSL operations will never be called, thus causing the leak.

Since I am binding shared_ptr<ssl_session>s into my SSL handlers, this leak will also keep alive my SSL session objects.


patch Download (8.5 KB) - added by tianhao.qiu@… 7 years ago.

Change History

Changed 7 years ago by tianhao.qiu@…

comment:1 Changed 7 years ago by tianhao.qiu@…

Patch submitted.

The old design deletes the handler (io_handler/handshake_handler/shutdown_handler) and openssl_operation objects in the handler_impl() function. However pending handler_impl() functions are not invoked when the io_service object is stopped, thus causing the leak.

The patch addresses the problem by wrapping the handler and openssl_operation objects in shared_ptrs.

comment:2 Changed 6 years ago by chris_kohlhoff

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

As of [72428], the release branch contains the new SSL implementation that addresses this.


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.