Release native verify callback when SSLEngine is closed#180
Merged
douzzer merged 3 commits intowolfSSL:masterfrom Mar 30, 2024
Merged
Release native verify callback when SSLEngine is closed#180douzzer merged 3 commits intowolfSSL:masterfrom
douzzer merged 3 commits intowolfSSL:masterfrom
Conversation
…ssion.setVerify()
… garbage collection
…dedSSLClient to allow easier analysis with VisualVM
douzzer
approved these changes
Mar 30, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR modifies
SSLEngineso that it explicitly releases the native wolfSSL verify callback when the SSLEngine enters the CLOSED state. Once CLOSED, an SSLEngine will not be reused. From the Javadocs for SSLEngine, "Once an engine is closed, it is not reusable: a new SSLEngine must be created."The native verify callback is stored as a JNI global variable, which can hold up garbage collection if not explicitly released. Prior to this PR it was being released/freed when the native
WOLFSSLstructure was freed, but with the changes in #159, the circular reference between SSLEngine and WolfSSLInternalVerifyCallback prevented SSLEngine objects from being garbage collected.