Uh oh!
There was an error while loading. Please reload this page.
lib: refactor transferable AbortSignal - #44048
Conversation
jasnell
commented
Jul 30, 2022
+1! Btw, so folks know, this is my son. He wanted something to help get started contributing so I recommended that he take over this change. /Cc @mcollina |
jasnell
commented
Jul 30, 2022
Ok, it looks like there was a change that landed recently that changed @flakey5 ... the patch below fixes the error here. You'll want to apply this patch locally, add it as a fixup commit (lookup how to use diff --git a/lib/internal/abort_controller.js b/lib/internal/abort_controller.js
index 313aee54fe..c5842a6638 100644
--- a/lib/internal/abort_controller.js+++ b/lib/internal/abort_controller.js@@ -82,6 +82,7 @@ const kAborted = Symbol('kAborted');
const kReason = Symbol('kReason');
const kCloneData = Symbol('kCloneData');
const kTimeout = Symbol('kTimeout');
+const kSignal = Symbol('kSignal');
function customInspect(self, obj, depth, options) {
if (depth < 0)
@@ -309,20 +310,23 @@ function abortSignal(signal, reason) {
}
class AbortController {
- #signal = createAbortSignal();+ // We can't use a private symbol here because doing so would prevent+ // transferableAbortController from being able to set the transferable+ // signal.+ [kSignal] = createAbortSignal();
/**
* @type {AbortSignal}
*/
get signal() {
- return this.#signal;+ return this[kSignal];
}
/**
* @param {any} reason
*/
abort(reason = new DOMException('This operation was aborted', 'AbortError')) {
- abortSignal(this.#signal, reason);+ abortSignal(this[kSignal], reason);
}
[customInspectSymbol](depth, options) { |
Uh oh!
There was an error while loading. Please reload this page.
mcollina
left a comment
There was a problem hiding this comment.
lgtm
Adding a benchmark would be nice, but not strictly necessary.
ShogunPanda
commented
Jul 30, 2022
@mcollina I think that's the first time I've read this from you. XD |
mcollina
commented
Jul 30, 2022
This has been thoroughly identified as a major fetch issue by @RafaelGSS and @devsnek in nodejs/undici#1203 (comment) and nodejs/undici#1203 (comment). |
nodejs-github-bot
commented
Jul 30, 2022
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rluvaton
commented
Jul 30, 2022
Family goals |
This comment was marked as outdated.
This comment was marked as outdated.
targos
commented
Aug 2, 2022
There's a failing test: |
jasnell
commented
Aug 3, 2022
@flakey5 ... after the github action checks complete here, if they all come up green, go ahead and squash all of the commits here into a single commit. After, I will run this through the regular CI. Assuming that comes up green, we should be good to go to get this landed :-) |
This comment was marked as outdated.
This comment was marked as outdated.
danielleadams
commented
Aug 16, 2022
@flakey5 do you mind creating a backport PR to this for v18.x? This broke tests on the release line. Thank you. |
juanarbol
commented
Oct 3, 2022
Same for v16.x |
flakey5
commented
Oct 9, 2022
My bad didn't see either of these. I'll start working on the v18.x backport in a sec |
Co-authored-by: James M Snell <jasnell@gmail.com> PR-URL: nodejs#44048 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
flakey5
commented
Oct 9, 2022
v18.x backport: #44941 |
Co-authored-by: James M Snell <jasnell@gmail.com> PR-URL: #44048 Backport-PR-URL: #44941 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
watch mode (experimental): Running in 'watch' mode using `node --watch` restarts the process when an imported file is changed. Contributed by Moshe Atlow in [#44366](#44366) Other notable changes: * fs: * (SEMVER-MINOR) add `FileHandle.prototype.readLines` (Antoine du Hamel) #42590 * http: * (SEMVER-MINOR) add writeEarlyHints function to ServerResponse (Wing) #44180 * http2: * (SEMVER-MINOR) make early hints generic (Yagiz Nizipli) #44820 * lib: * (SEMVER-MINOR) refactor transferable AbortSignal (flakey5) #44048 * src: * (SEMVER-MINOR) add detailed embedder process initialization API (Anna Henningsen) #44121 * util: * (SEMVER-MINOR) add default value option to parsearg (Manuel Spigolon) #44631 PR-URL: #44968
watch mode (experimental): Running in 'watch' mode using `node --watch` restarts the process when an imported file is changed. Contributed by Moshe Atlow in [#44366](#44366) Other notable changes: * fs: * (SEMVER-MINOR) add `FileHandle.prototype.readLines` (Antoine du Hamel) #42590 * http: * (SEMVER-MINOR) add writeEarlyHints function to ServerResponse (Wing) #44180 * http2: * (SEMVER-MINOR) make early hints generic (Yagiz Nizipli) #44820 * lib: * (SEMVER-MINOR) refactor transferable AbortSignal (flakey5) #44048 * src: * (SEMVER-MINOR) add detailed embedder process initialization API (Anna Henningsen) #44121 * util: * (SEMVER-MINOR) add default value option to parsearg (Manuel Spigolon) #44631 PR-URL: #44968
watch mode (experimental): Running in 'watch' mode using `node --watch` restarts the process when an imported file is changed. Contributed by Moshe Atlow in [#44366](#44366) Other notable changes: * fs: * (SEMVER-MINOR) add `FileHandle.prototype.readLines` (Antoine du Hamel) #42590 * http: * (SEMVER-MINOR) add writeEarlyHints function to ServerResponse (Wing) #44180 * http2: * (SEMVER-MINOR) make early hints generic (Yagiz Nizipli) #44820 * lib: * (SEMVER-MINOR) refactor transferable AbortSignal (flakey5) #44048 * src: * (SEMVER-MINOR) add detailed embedder process initialization API (Anna Henningsen) #44121 * util: * (SEMVER-MINOR) add default value option to parsearg (Manuel Spigolon) #44631 PR-URL: #44968
watch mode (experimental): Running in 'watch' mode using `node --watch` restarts the process when an imported file is changed. Contributed by Moshe Atlow in #44366 Other notable changes: * fs: * (SEMVER-MINOR) add `FileHandle.prototype.readLines` (Antoine du Hamel) #42590 * http: * (SEMVER-MINOR) add writeEarlyHints function to ServerResponse (Wing) #44180 * http2: * (SEMVER-MINOR) make early hints generic (Yagiz Nizipli) #44820 * lib: * (SEMVER-MINOR) refactor transferable AbortSignal (flakey5) #44048 * src: * (SEMVER-MINOR) add detailed embedder process initialization API (Anna Henningsen) #44121 * util: * (SEMVER-MINOR) add default value option to parsearg (Manuel Spigolon) #44631 PR-URL: #44968
watch mode (experimental): Running in 'watch' mode using `node --watch` restarts the process when an imported file is changed. Contributed by Moshe Atlow in #44366 Other notable changes: * fs: * (SEMVER-MINOR) add `FileHandle.prototype.readLines` (Antoine du Hamel) #42590 * http: * (SEMVER-MINOR) add writeEarlyHints function to ServerResponse (Wing) #44180 * http2: * (SEMVER-MINOR) make early hints generic (Yagiz Nizipli) #44820 * lib: * (SEMVER-MINOR) refactor transferable AbortSignal (flakey5) #44048 * src: * (SEMVER-MINOR) add detailed embedder process initialization API (Anna Henningsen) #44121 * util: * (SEMVER-MINOR) add default value option to parsearg (Manuel Spigolon) #44631 PR-URL: #44968
watch mode (experimental): Running in 'watch' mode using `node --watch` restarts the process when an imported file is changed. Contributed by Moshe Atlow in #44366 Other notable changes: * fs: * (SEMVER-MINOR) add `FileHandle.prototype.readLines` (Antoine du Hamel) #42590 * http: * (SEMVER-MINOR) add writeEarlyHints function to ServerResponse (Wing) #44180 * http2: * (SEMVER-MINOR) make early hints generic (Yagiz Nizipli) #44820 * lib: * (SEMVER-MINOR) refactor transferable AbortSignal (flakey5) #44048 * src: * (SEMVER-MINOR) add detailed embedder process initialization API (Anna Henningsen) #44121 * util: * (SEMVER-MINOR) add default value option to parsearg (Manuel Spigolon) #44631 PR-URL: #44968
Took over the pr from @jasnell with his permission. Original pr was #43388 which can be closed now, feedback comments from there were addressed here.
Co-authored-by: James M Snell jasnell@gmail.com