-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for OpenSslEngine with no finalizer #1669
Support for OpenSslEngine with no finalizer #1669
Conversation
bba18cf
to
2d3185a
Compare
Currently enabling openssl_refcnt using a custom DefaultSslEngineFactory.. public static class ReferenceCountedOpenSslEngineFactory extends DefaultSslEngineFactory {
private SslProvider provider;
@Override
public void init(AsyncHttpClientConfig config) throws SSLException {
this.provider = config.isUseOpenSsl() ? SslProvider.OPENSSL_REFCNT : SslProvider.JDK;
super.init(config);
}
@Override
protected SslContextBuilder configureSslContextBuilder(SslContextBuilder builder) {
return builder.sslProvider(provider);
}
} |
Motivation: Support for Netty SslProvider.OPENSSL_REFCNT (OpenSSL-based implementation which does not have finalizers and instead implements ReferenceCounted). Modification: Add destroy method to SslEngineFactory to allow cleaning up reference counted SslContext. Result: Users can opt-in to a finalizer free OpenSslEngine and OpenSslContext.
2d3185a
to
e6adb5e
Compare
As a side note I ran the ATC testsuite with |
Thanks! |
As a side issue, it would be nice to be able to enable from config instead of having to go with a custom SslEngineFactory. |
@slandelle I did consider that, however, OPENSSL_REFCNT is currently marked UnstableApi and wanted to avoid dependency issues with Netty. |
Do you mean you're not sure OPENSSL_REFCNT is production ready yet and you want to experiment first? |
I believe it is production ready, however it is still marked "unstable" in Netty here https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/SslProvider.java#L37 |
OK, let's leave as is for now. |
Motivation:
Support for Netty SslProvider.OPENSSL_REFCNT (OpenSSL-based implementation which does not have finalizers and instead implements ReferenceCounted).
Modification:
Add destroy method to SslEngineFactory to allow cleaning up reference counted SslContext.
Result:
Users can opt-in to a finalizer free OpenSslEngine and OpenSslContext.