-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
Race condition between adding and removing SslHandler causing NPE #8676
Comments
@mingyu89 I wonder how this can happen... |
@normanmaurer Thank you for looking at it.
which add the handler to pipleline. |
It should not... is this called from outside the EventLoop ? |
@mingyu89 actually I think I know what happens here... Let me come up with a fix. |
…adding the handler to the pipeline. Motivation: Due a race in DefaultChannelPipeline / AbstractChannelHandlerContext it was possible to have only handlerRemoved(...) called during tearing down the pipeline, even when handlerAdded(...) was never called. We need to ensure we either call both of none to guarantee a proper lifecycle of the handler. Modifications: - Enforce handlerAdded(...) / handlerRemoved(...) semantics / ordering - Add unit test. Result: Fixes #8676 / #6536 .
@normanmaurer Thank you! |
…adding the handler to the pipeline. (#8684) Motivation: Due a race in DefaultChannelPipeline / AbstractChannelHandlerContext it was possible to have only handlerRemoved(...) called during tearing down the pipeline, even when handlerAdded(...) was never called. We need to ensure we either call both of none to guarantee a proper lifecycle of the handler. Modifications: - Enforce handlerAdded(...) / handlerRemoved(...) semantics / ordering - Add unit test. Result: Fixes #8676 / #6536 .
…adding the handler to the pipeline. (#8684) Motivation: Due a race in DefaultChannelPipeline / AbstractChannelHandlerContext it was possible to have only handlerRemoved(...) called during tearing down the pipeline, even when handlerAdded(...) was never called. We need to ensure we either call both of none to guarantee a proper lifecycle of the handler. Modifications: - Enforce handlerAdded(...) / handlerRemoved(...) semantics / ordering - Add unit test. Result: Fixes #8676 / #6536 .
…adding the handler to the pipeline. Motivation: Due a race in DefaultChannelPipeline / AbstractChannelHandlerContext it was possible to have only handlerRemoved(...) called during tearing down the pipeline, even when handlerAdded(...) was never called. We need to ensure we either call both of none to guarantee a proper lifecycle of the handler. Modifications: - Enforce handlerAdded(...) / handlerRemoved(...) semantics / ordering - Add unit test. Result: Fixes netty/netty#8676 / netty/netty#6536 .
We are seeing the same issue as in ticket #6536 on version 4.1.28.
The variable
pendingUnencryptedWrites
in SslHandler is initialized in method "handlerAdded" if the following sequence of event happens, we will hit this NPE :SslHandler.handlerRemoved0
from disconnecting channel. This will accesspendingUnencryptedWrites
and throw NPESslHandler.handlerAdded
and initialize pendingUnencryptedWrites. But it's too late.The text was updated successfully, but these errors were encountered: