-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
tls: fix writeQueueSize prop, long write timeouts #15791
tls: fix writeQueueSize prop, long write timeouts #15791
Conversation
/cc @indutny |
bdc43c5
to
fdf7a79
Compare
Just a minor update to use /cc @mcollina |
Is updating this state have a performance impact? Have you tried to run our benchmarks? I think we can run them on CI if you do not have the spare CPU cycles (they take a long time). |
I ran all the benchmarks and didn't see any discernible difference at a 100 runs. The way it's handled, it only updates it once when DoWrite is called and then when it's finished (flushed). Similar to the way it's handled in the regular net socket.
|
Might need to refactor the test a bit as it's failing on SmartOS. Will get it done this weekend.
The rest seem fine.
|
I've updated the tests to, hopefully, be less flaky. Would appreciate if we could get another CI started. Thanks! |
Well, this might take a while. If anyone has any ideas on making these less timeout dependant (while still testing the timeout bug), I'm all ears. |
06f4d9f
to
875872d
Compare
Ok, I think this should work... ? I can run a stress test on the test on my local system now and it doesn't fail (before only 50% succeeded). Since it's still in |
Well, this seems to succeed everywhere but SmartOS so I guess an improvement... Anyone have any suggestions by any chance? Going to try setting up a SmartOS box to test on... |
875872d
to
8969906
Compare
Ok, one last try. If this doesn't fix SmartOS then there's a deeper issue that might not have anything to do with the test itself. I can run this for an hour on my system (96 instances at a time) without any failures (previous version would fail like 2.5% of the time). (And master still fails this test 100% of the time.) |
8969906
to
daf7931
Compare
Oops, I accidentally deleted a few characters before committing the http version of the test so it was testing with readSize of 3333 instead of 333333. No wonder it failed. Could we run the CI just on SmartOS (and OS X)? If that doesn't work, I have one other potential direction to take this test... |
Thanks for starting it @mcollina. No luck this time either :( No clue if there's a bug in http on SmartOS related to writeQueueSize or if it's just the test. Almost done setting up a SmartOS box so I guess I'll find out... |
Having a SmartOS box really made this easy to fix. Should be good for another CI run now. |
Thanks! Looks like it worked this time (the SmartOS failure is unrelated, it's in ping @indutny since you know the most about the TLS code. |
e00c69c
to
caa179d
Compare
Add updateWriteQueueSize which updates and returns queue size (net & tls). Make _onTimeout check whether an active write is ongoing and if so, call _unrefTimer rather than emitting a timeout event. Add http & https test that checks whether long-lasting (but active) writes timeout or can finish writing as expected. PR-URL: nodejs#15791 Fixes: nodejs#15082 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
This commit handles the case where _onTimeout is called with a null handle. Refs: #15791 Fixes: #16484 PR-URL: #16489 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit handles the case where _onTimeout is called with a null handle. Refs: #15791 Fixes: #16484 PR-URL: #16489 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit handles the case where _onTimeout is called with a null handle. Refs: nodejs#15791 Fixes: nodejs#16484 PR-URL: nodejs#16489 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Make writeQueueSize represent the actual size of the write queue within the TLS socket. Add tls test to confirm that bufferSize works as expected. PR-URL: nodejs/node#15791 Fixes: nodejs/node#15005 Refs: nodejs/node#15006 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Add updateWriteQueueSize which updates and returns queue size (net & tls). Make _onTimeout check whether an active write is ongoing and if so, call _unrefTimer rather than emitting a timeout event. Add http & https test that checks whether long-lasting (but active) writes timeout or can finish writing as expected. PR-URL: nodejs/node#15791 Fixes: nodejs/node#15082 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
This commit handles the case where _onTimeout is called with a null handle. Refs: nodejs/node#15791 Fixes: nodejs/node#16484 PR-URL: nodejs/node#16489 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Make writeQueueSize represent the actual size of the write queue within the TLS socket. Add tls test to confirm that bufferSize works as expected. PR-URL: nodejs/node#15791 Fixes: nodejs/node#15005 Refs: nodejs/node#15006 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Add updateWriteQueueSize which updates and returns queue size (net & tls). Make _onTimeout check whether an active write is ongoing and if so, call _unrefTimer rather than emitting a timeout event. Add http & https test that checks whether long-lasting (but active) writes timeout or can finish writing as expected. PR-URL: nodejs/node#15791 Fixes: nodejs/node#15082 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
This commit handles the case where _onTimeout is called with a null handle. Refs: nodejs/node#15791 Fixes: nodejs/node#16484 PR-URL: nodejs/node#16489 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Make writeQueueSize represent the actual size of the write queue within the TLS socket. Add tls test to confirm that bufferSize works as expected. PR-URL: nodejs#15791 Fixes: nodejs#15005 Refs: nodejs#15006 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Add updateWriteQueueSize which updates and returns queue size (net & tls). Make _onTimeout check whether an active write is ongoing and if so, call _unrefTimer rather than emitting a timeout event. Add http & https test that checks whether long-lasting (but active) writes timeout or can finish writing as expected. PR-URL: nodejs#15791 Fixes: nodejs#15082 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
This commit handles the case where _onTimeout is called with a null handle. Refs: nodejs#15791 Fixes: nodejs#16484 PR-URL: nodejs#16489 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Make writeQueueSize represent the actual size of the write queue within the TLS socket. Add tls test to confirm that bufferSize works as expected. Backport-PR-URL: #16420 PR-URL: #15791 Fixes: #15005 Refs: #15006 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Add updateWriteQueueSize which updates and returns queue size (net & tls). Make _onTimeout check whether an active write is ongoing and if so, call _unrefTimer rather than emitting a timeout event. Add http & https test that checks whether long-lasting (but active) writes timeout or can finish writing as expected. Backport-PR-URL: #16420 PR-URL: #15791 Fixes: #15082 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
This commit handles the case where _onTimeout is called with a null handle. Backport-PR-URL: #16420 Refs: #15791 Fixes: #16484 PR-URL: #16489 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Make writeQueueSize represent the actual size of the write queue within the TLS socket. Add tls test to confirm that bufferSize works as expected. Backport-PR-URL: #16420 PR-URL: #15791 Fixes: #15005 Refs: #15006 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Add updateWriteQueueSize which updates and returns queue size (net & tls). Make _onTimeout check whether an active write is ongoing and if so, call _unrefTimer rather than emitting a timeout event. Add http & https test that checks whether long-lasting (but active) writes timeout or can finish writing as expected. Backport-PR-URL: #16420 PR-URL: #15791 Fixes: #15082 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
This commit handles the case where _onTimeout is called with a null handle. Backport-PR-URL: #16420 Refs: #15791 Fixes: #16484 PR-URL: #16489 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This PR addresses a long-standing issue of
_handle.writeQueueSize
in TLS not representing the actual write queue (#15005), as well as the fact that long-lasting writes on both net & tls (http & https) will currently timeout if a socket timeout is set (#15082). The latter has been reported as being in relation to the keep alive timeout but in reality it's just a broad issue that is the most obvious with keep-alive since it's much shorter at 5s (vs 120s).writeQueueSize
represent the actual size of the write queue within the TLS socket.bufferSize
works as expected.Second commit:
getWriteQueueSize
onTLSWrap
which updates and returns queue size (net & tls)._onTimeout
check whether an active write is ongoing and if so, call_unrefTimer
rather than emitting a timeout event.Haven't worked in C++ in a very, very long time so would definitely appreciate any and all feedback there.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
http, https, net, test, tls