-
Notifications
You must be signed in to change notification settings - Fork 8
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
Listeners > BootSSLContext: improve locking access to cached sslConte… #295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is promising, but you are missing local map invalidation
LOG.log(Level.FINER, "resolve SNI mapping " + sniHostname + ", key: " + key); | ||
private final class ListenerSniMapping implements io.netty.util.AsyncMapping<String, SslContext> { | ||
|
||
private final Map<String, SslContext> listenerSslContexts = new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to be Concurrent as is accessed only by this thread
return bootSslContext(listener, choosen); | ||
} catch (ConfigurationNotValidException err) { | ||
throw new RuntimeException(err); | ||
sslContext = bootSslContext(listener, choosen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk if you did it on purpose, but now there is a possibility where more than one listener will create the SslContext for the same key
btw this is a less locking-situation so I hope this will decrease latency (maybe with more CPU usages in some cases)
throw new RuntimeException(err); | ||
sslContext = bootSslContext(listener, choosen); | ||
listenerSslContexts.put(key, sslContext); | ||
sslContexts.put(key, sslContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sslContexts is invalidated when the config changes, we need to invalidate this local map as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
#295) * Listeners > BootSSLContext: improve locking access to cached sslContexes #294 * fix pr comments * fix cache clear Co-authored-by: Paolo Venturi <[email protected]>
PR for #294