-
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
quic: additional quic refactors/cleanups #34160
Conversation
Use is_* and set_* pattern for native object flags to improve readability in the code.
092153e
to
244b88e
Compare
This comment has been minimized.
This comment has been minimized.
0071050
to
bab96a7
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Updated QUIC CI: https://ci.nodejs.org/job/node-test-commit/39444/ |
The QuicSession can be destroyed during garbage collection and the onSessionDestroy callback was happening in the destructor.
Because of the timing of qlog events emitted by ngtcp2, it becomes difficult to handle those as events on the QuicSession object because the final qlog entry is not emitted until the ngtcp2_conn is freed, which can occur when the object is being garbage collected (meaning, we a: can't call out to javascript and b: don't have an object we can use to emit the event). This refactors it into a QLogStream object that allows the qlog data to be piped out using a separate Readable stream.
@addaleax... updated, PTAL |
Updated QUIC CI: https://ci.nodejs.org/job/node-test-commit/39450/ |
What's the difference between a vanilla QUIC implementation with the proper ALPN and QuicTransport? I know this probably isn't the best place to talk about this, but I am going to hold off on making a new issue until this PR is merged. |
PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
Use is_* and set_* pattern for native object flags to improve readability in the code. PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
The QuicSession can be destroyed during garbage collection and the onSessionDestroy callback was happening in the destructor. PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
Because of the timing of qlog events emitted by ngtcp2, it becomes difficult to handle those as events on the QuicSession object because the final qlog entry is not emitted until the ngtcp2_conn is freed, which can occur when the object is being garbage collected (meaning, we a: can't call out to javascript and b: don't have an object we can use to emit the event). This refactors it into a QLogStream object that allows the qlog data to be piped out using a separate Readable stream. PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #34160 Reviewed-By: Anna Henningsen <[email protected]>
Landed in 56dbe46...1b1e985 |
This is ready for review...
The first three commits are general improvements to improve maintainability, readability, and quality of the c++ code...
This commit refactors the QuicSession close/destroy flow to (a) make it more correct and (b) make it far easier to reason about.
The shared state between the C++ side and the JavaScript side was using an AliasedArray where everything was uint64_t, which is wasteful given that most of the state fields are simple booleans. Using an AliasedStruct allows it to be more compact but does make reading it a bit more complicated on the JS side. Overall, this should be easier to maintain.
The onSessionDestroy callback was calling out to JavaScript during the
QuicSession
C++ object deconstruction, which could happen during garbage collection, so that's a no-no. This eliminates that callback.What it says on the tin.
Also self-explanatory
When the
QuicSession
is GC'd without a proper destroy, the timers weren't being freed properly. Makesure they are stopped.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes