| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
+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 |
Sorry, something went wrong.
|
Ok, it looks like there was a change that landed recently that changed AbortController to use a private #signal field instead of the internal kSymbol.... unfortunately that isn't going to work with the new util.transferableAbortController() API since that needs to be able to create the AbortController instance without using the default constructor. /cc @joyeecheung ... @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 git commit --fixup) and push the additional commit up 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) { |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Adding a benchmark would be nice, but not strictly necessary.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM!
Sorry, something went wrong.
@mcollina I think that's the first time I've read this from you. XD |
Sorry, something went wrong.
|
This has been thoroughly identified as a major fetch issue by @RafaelGSS and @devsnek in nodejs/undici#1203 (comment) and nodejs/undici#1203 (comment). |
Sorry, something went wrong.
Sorry, something went wrong.
Family goals |
Sorry, something went wrong.
|
There's a failing test: === release test-abortcontroller ===
Path: parallel/test-abortcontroller
Error: --- stderr ---
node:assert:124
throw new AssertionError(obj);
^
AssertionError [ERR_ASSERTION]: Missing expected exception (TypeError).
at Object.<anonymous> (/home/runner/work/node/node/test/parallel/test-abortcontroller.js:109:5)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
at node:internal/main/run_main_module:17:47 {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: undefined,
expected: { name: 'TypeError' },
operator: 'throws'
}
Node.js v19.0.0-pre
Command: out/Release/node --no-warnings --expose-gc --expose-internals /home/runner/work/node/node/test/parallel/test-abortcontroller.js
|
Sorry, something went wrong.
|
@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 :-) |
Sorry, something went wrong.
|
@flakey5 do you mind creating a backport PR to this for v18.x? This broke tests on the release line. Thank you. |
Sorry, something went wrong.
Same for v16.x |
Sorry, something went wrong.
My bad didn't see either of these. I'll start working on the v18.x backport in a sec |
Sorry, something went wrong.
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>
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 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
| Back | FazBrowse Home | New Git URL |
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