Uh oh!
There was an error while loading. Please reload this page.
tls: emit errors on close whilst async action - #1702
Conversation
indutny
commented
May 14, 2015
cc @iojs/crypto |
migounette
commented
May 14, 2015
@indutny You fixed at the JS part by checking the _handle, but what I found during an intensive play with TLS is that the _encout was NULL (a C++ level). It is a kind of SSL Close issue race condition (for me), but I need to change the test case because it's very difficult for me to reproduce. Thanks for the fix |
indutny
commented
May 18, 2015
@migounette@EricTheOne: I have updated the PR, please take a look |
EricTheOne
commented
May 19, 2015
@indutny thanks, applied both patches in order on v2.0.2, getting a segfault elsewhere (maybe it's progress): |
indutny
commented
May 19, 2015
@EricTheOne pushed one more commit, PTAL |
EricTheOne
commented
May 19, 2015
@indutny I've applied all three commits in order, on v2.0.2. Getting a different segfault now: |
indutny
commented
May 22, 2015
@EricTheOne looks like I don't fully understand problem yet. Any way I can reproduce it locally? |
indutny
commented
May 29, 2015
Just a heads up, @evanlucas discovered a crash in a test: https://gist.github.com/evanlucas/6ab0a62ebe7ffa5d0ddf It is reproducible after patching the test suite: diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js
index e156f44..292bd4f 100644
--- a/test/parallel/test-tls-js-stream.js+++ b/test/parallel/test-tls-js-stream.js@@ -61,6 +61,7 @@ var server = tls.createServer({
socket.end('hello');
socket.resume();
+ socket.destroy();
});
socket.once('close', function() {Going to investigate it in detail later. |
indutny
commented
May 29, 2015
@evanlucas and it is actually fixed by this commit ad3a799 |
indutny
commented
May 29, 2015
Erm, not by commit, rather by this PR. |
evanlucas
commented
May 29, 2015
yay! |
indutny
commented
May 29, 2015
Which is kind of sad for the @EricTheOne's thing... |
indutny
commented
May 29, 2015
When loading session, OCSP response, SNI, always check that the `self._handle` is present. If it is not - the socket was closed - and we should emit the error instead of throwing an uncaught exception. Fix: nodejs/node-v0.x-archive#8780Fix: nodejs#1696
* Destroy `SSL*` and friends on a next tick to make sure that we are not doing it in one of the OpenSSL callbacks * Add more checks to the C++ methods that might be invoked during destructor's pending queue cleanup Fix: nodejs/node-v0.x-archive#8780Fix: nodejs#1696
indutny
commented
Jun 1, 2015
@migounette@EricTheOne any news? ;) |
indutny
commented
Jun 1, 2015
CI (with style fixes): https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/747/ |
indutny
commented
Jun 1, 2015
CI is green. |
trevnorris
commented
Jun 4, 2015
@indutny going to merge this? |
indutny
commented
Jun 4, 2015
Yeah, let's land it. @trevnorris LGTY? |
trevnorris
commented
Jun 4, 2015
LGTM |
When loading session, OCSP response, SNI, always check that the `self._handle` is present. If it is not - the socket was closed - and we should emit the error instead of throwing an uncaught exception. Fix: nodejs/node-v0.x-archive#8780Fix: #1696 PR-URL: #1702 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
* Destroy `SSL*` and friends on a next tick to make sure that we are not doing it in one of the OpenSSL callbacks * Add more checks to the C++ methods that might be invoked during destructor's pending queue cleanup Fix: nodejs/node-v0.x-archive#8780Fix: #1696 PR-URL: #1702 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
PR-URL: #1702 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
indutny
commented
Jun 4, 2015
There was a problem hiding this comment.
Not sure if the error message sounds like a TypeError
There was a problem hiding this comment.
Yeah, I think it is worth submitting a follow-up fix PR. ;)
There was a problem hiding this comment.
@indutny I feel that the default types of Errors is not enough. We should at least have something like ValueError. What do you think?
There was a problem hiding this comment.
I'd say it might be too expensive to create them in C++, unless I'm missing something obvious.
There was a problem hiding this comment.
I locally created a patch which fixes all the inconsistent error messages like this, in the js files. And I had an internal/errors.js file which defined ValueError. Looks like that solves most of the wrong data error messages. But I am not sure if it is worthy introducing a new Error type.
There was a problem hiding this comment.
Yeah, I don't think anyone really checks the type of error. It kind of serves only an informational purpose when it pops up in the stderr.
When loading session, OCSP response, SNI, always check that the
self._handleis present. If it is not - the socket was closed - and weshould emit the error instead of throwing an uncaught exception.
Fix: nodejs/node-v0.x-archive#8780
Fix: #1696