Bug #104461 Contribution by Facebook: Fix SSL memory leak on connection close (code for ...
Submitted: 29 Jul 2021 16:52 Modified: 29 Jul 2021 17:02
Reporter: FBContrib Admin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:8.0.17 OS:Any
Assigned to: CPU Architecture:Any

[29 Jul 2021 16:52] FBContrib Admin
Description:
Background innformation provided by Facebook:
Abstract:

https://bugs.mysql.com/bug.php?id=102189

This bug affects the async client case, in the event of a connection timeout.

In some cases, we could be initiating a VIO shutdown and cleanup on a
VIO struct that has a non-null ssl_arg using the fallback vio_delete()
function instead of the vio_ssl_delete() function. This causes a memory
leak on the SSL struct because nothing is freeing it.

The ssl_arg is deleted in the call to vio_ssl_delete(), which gets called if the
type == VIO_TYPE_SSL. However in some cases, the type we get is VIO_TYPE_TCPIP
(probably some transient state, interrupted from becoming VIO_TYPE_SSL
maybe by the timeout), and because of that, we call vio_delete() instead of vio_ssl_delete(),
which doesn't free up the SSL data.
 Use case:

Fixes async client memory leak

Repo: https://github.com/mysql/mysql-server 

Patch on top of 8.0.17: https://github.com/mysql/mysql-server/commit/4869291f7ee

How to repeat:
See description

Suggested fix:
See contribution code attached
[29 Jul 2021 16:52] FBContrib Admin
Fix SSL memory leak on connection close (code for 102189) 
(*) This code is contributed under the Facebook agreement

Contribution: fb_patch_255.txt (text/plain), 1000 bytes.

[29 Jul 2021 17:02] Omer Barnir
Posted by developer:
 
Closing bug as contribution was used as part of fixing bug#102189
[29 Jul 2021 17:06] Omer Barnir
Thanks Facebook for the contribution
[9 Aug 2021 21:12] Christine Cole
Added bug IDs to the original changelog entry.