Skip to content

Conversation

@peterzhu2118
Copy link
Member

OpenSSL::Provider does not automatically unload at shutdown, causing it to be reported as a memory leak by memory leak checkers when using RUBY_FREE_AT_EXIT. For example, LSAN reports many memory leaks that looks like this:

#15 0x78dd17e2dfb4  (/lib/x86_64-linux-gnu/libcrypto.so.3+0x22dfb4)
#16 0x78dd17e2b195 in OSSL_PROVIDER_try_load (/lib/x86_64-linux-gnu/libcrypto.so.3+0x22b195)
#17 0x78dd35ba8751 in ossl_provider_s_load ext/openssl/ossl_provider.c:60:16

This commit adds a hook at shutdown to unload all the OpenSSL providers.

OpenSSL::Provider does not automatically unload at shutdown, causing it
to be reported as a memory leak by memory leak checkers when using
RUBY_FREE_AT_EXIT. For example, LSAN reports many memory leaks that looks
like this:

    #15 0x78dd17e2dfb4  (/lib/x86_64-linux-gnu/libcrypto.so.3+0x22dfb4)
    #16 0x78dd17e2b195 in OSSL_PROVIDER_try_load (/lib/x86_64-linux-gnu/libcrypto.so.3+0x22b195)
    #17 0x78dd35ba8751 in ossl_provider_s_load ext/openssl/ossl_provider.c:60:16

This commit adds a hook at shutdown to unload all the OpenSSL providers.
@peterzhu2118
Copy link
Member Author

Ah looks like this issue was fixed in openssl/openssl@927d056 and included since OpenSSL 3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants