-
Notifications
You must be signed in to change notification settings - Fork 2k
Issue #12818 - fix potential NPE from WebSocketConnection #13264
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
Issue #12818 - fix potential NPE from WebSocketConnection #13264
Conversation
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
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.
Just a nit.
@@ -429,6 +464,28 @@ public void cancelDemand() | |||
|
|||
private void fillAndParse() | |||
{ | |||
boolean doClose = false; |
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.
Rename to just close
like above.
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.
Approved with a niggle
...ebsocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketConnection.java
Show resolved
Hide resolved
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
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.
How about this
...ebsocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketConnection.java
Outdated
Show resolved
Hide resolved
…n/java/org/eclipse/jetty/websocket/core/WebSocketConnection.java Co-authored-by: Greg Wilkins <gregw@webtide.com>
Fixes #12818 and #13225
If a close
WebSocketConnection.onClose
event happens duringfillAndParse()
then the network buffer is nulled out while it is still in use potentially causing NPE.This fixes this issue by introducing a new atomic state so that onClosed() serializes the close actions with
fillAndParse()
.