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
Fix race when handling delegating tasks in ReferenceCountedOpenSslEngine #12149
Conversation
Motivation: Due incorrect handling of delegating tasks in ReferenceCountedOpenSslEngine it was possible to observe handshake timeouts / failures. Modification: - Only reset needsTask variable after we actually ran the task. - Add missing synchronized as otherwise we might end up calling native code concurrently which is not safe. - Change how we excute delegating tasks in our SSLEngineTest. This change would result in timeouts / failures before the fix. Result: Fixes #12139
@chrisvest I opened a PR against 4.1 and main to proof that for both cases all works. |
@@ -1475,19 +1469,22 @@ public void run() { | |||
public void run(final Runnable runnable) { | |||
if (isDestroyed()) { | |||
// The engine was destroyed in the meantime, just return. | |||
runnable.run(); |
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.
@normanmaurer intentionally not running the runnable in this refactor if the engine is destroyed?
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.
Yes as the SSL object is already destroyed
…ine (netty#12149) Motivation: Due incorrect handling of delegating tasks in ReferenceCountedOpenSslEngine it was possible to observe handshake timeouts / failures. Modification: - Only reset needsTask variable after we actually ran the task. - Add missing synchronized as otherwise we might end up calling native code concurrently which is not safe. - Change how we excute delegating tasks in our SSLEngineTest. This change would result in timeouts / failures before the fix. Result: Fixes netty#12139
…ine (netty#12149) Motivation: Due incorrect handling of delegating tasks in ReferenceCountedOpenSslEngine it was possible to observe handshake timeouts / failures. Modification: - Only reset needsTask variable after we actually ran the task. - Add missing synchronized as otherwise we might end up calling native code concurrently which is not safe. - Change how we excute delegating tasks in our SSLEngineTest. This change would result in timeouts / failures before the fix. Result: Fixes netty#12139
Motivation:
Due incorrect handling of delegating tasks in ReferenceCountedOpenSslEngine it was possible to observe handshake timeouts / failures.
Modification:
Result:
Fixes #12139