Opened 13 years ago

Closed 11 years ago

#3702 closed Bugs (fixed)

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:

Description

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.

Attachments (1)

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

Download all attachments as: .zip

Change History (3)

by tianhao.qiu@…, 13 years ago

Attachment: patch added

comment:1 by tianhao.qiu@…, 13 years ago

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 by chris_kohlhoff, 11 years ago

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.