-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Crash in Node v8.x at lib/_tls_legacy.js.onclienthello() #26428
Comments
Thanks for the bug report. After checking the code I think there may be more than one bug to fix in |
Thanks! We were thinking of a simple fix since that file disappears in v10.x, but any deeper solutions are of course welcome. |
This seems to have been broken ever since its introduction 5 years ago in commit 75ea11f ("tls: introduce asynchronous `newSession`") and no one complained but that's not going to stop me from fixing it anyway because otherwise I can't write a regression test for issue nodejs#26428. Refs: nodejs#26428
There is a time window between the first and the last step of processing the clienthello event and the SecurePair may have been destroyed during that interval. Fixes: nodejs#26428
#26452 - if you have an opportunity to test it out, that would be great. |
Tested #26452 with our test case
Note: the |
This seems to have been broken ever since its introduction 5 years ago in commit 75ea11f ("tls: introduce asynchronous `newSession`") and no one complained but that's not going to stop me from fixing it anyway because otherwise I can't write a regression test for issue #26428. Refs: #26428 PR-URL: #26452 Fixes: #26428 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
There is a time window between the first and the last step of processing the clienthello event and the SecurePair may have been destroyed during that interval. Fixes: #26428 PR-URL: #26452 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
#26452 was merged in March but apparently didn't auto-close this issue. I'll do it the old-fashioned way then. |
At my company we have a TCP server accepting connections and securing them with
tls.createSecurePair()
. When there is high load in the server, usually due to lots of I/O traffic, we start seeing exceptions generated by the Node.js runtime.The crash is located at lib/_tls_legacy.js/onclienthello(): when the TLS connection is destroyed before the
setImmediate()
can run, this situation results in aTypeError: Cannot read property 'loadSession' of null
.The attached code
destroy-early.js
shows this issue with sample certificates from freelan:Essentially we open a couple of secure pairs, client and server, send cleartext to the client and then destroy the socket inside a
setImmediate()
:However if the socket is destroyed right away it works:
Bug exists in 8.x since at least 8.9.4 up until the latest 8.15.0. It is not present in v10 since
_tls_legacy.js
has disappeared.We are open to sending a pull request ourselves, essentially a one liner ensuring that
self.ssl
is not null before proceeding inonclienthello()
.Thanks!
destroy-early.tar.gz
The text was updated successfully, but these errors were encountered: