Uh oh!
There was an error while loading. Please reload this page.
child_process: use signal.reason in child process abort - #47817
Conversation
aduh95
commented
May 2, 2023
Shouldn't we keep rejecting with an |
debadree25
commented
May 2, 2023
Oh ok my bad it seems Thanks! |
debadree25
commented
May 2, 2023
Ok so the original issue mentions wanting the behavior to be like fetch, fetch seems to just pass the error without wrapping on AbortError so which way would be correct 🧐 |
benjamingr
commented
May 2, 2023
We don't want to throw |
debadree25
commented
May 2, 2023
Done updated to use cause, and included tests where the passed value is not a error, PTAL :-) Thanks! |
nodejs-github-bot
commented
May 2, 2023
nodejs-github-bot
commented
May 3, 2023
nodejs-github-bot
commented
May 3, 2023
nodejs-github-bot
commented
May 4, 2023
nodejs-github-bot
commented
May 6, 2023
Commit Queue failed- Loading data for nodejs/node/pull/47817 ✔ Done loading data for nodejs/node/pull/47817 ----------------------------------- PR info ------------------------------------ Title child_process: use signal.reason in child process abort (#47817) Author Debadree Chatterjee (@debadree25) Branch debadree25:ft/child-process-abort -> nodejs:main Labels child_process, semver-major, author ready, needs-ci, commit-queue-squash Commits 3 - child_process: use signal.reason in child process abort - fixup! add another test - fixup! use cause Committers 1 - Debadree Chatterjee PR-URL: https://github.com/nodejs/node/pull/47817 Fixes: https://github.com/nodejs/node/issues/47814 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Antoine du Hamel ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/47817 Fixes: https://github.com/nodejs/node/issues/47814 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Antoine du Hamel -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 02 May 2023 11:22:01 GMT ✔ Approvals: 2 ✔ - Benjamin Gruenbaum (@benjamingr): https://github.com/nodejs/node/pull/47817#pullrequestreview-1409488231 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/47817#pullrequestreview-1415776719 ✘ semver-major requires at least 2 TSC approvals ✔ Last GitHub CI successful ℹ Last Full PR CI on 2023-05-04T04:48:59Z: https://ci.nodejs.org/job/node-test-pull-request/51618/ - Querying data for job/node-test-pull-request/51618/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/4902048348 |
debadree25
commented
May 6, 2023
Ah requires another TSC approval could someone from @nodejs/tsc take a look! Thanks! |
Uh oh!
There was an error while loading. Please reload this page.
As this just adds .reason as .cause and doesn't replace the AbortError this also doesn't need to land as semver-major as it doesn't change error codes but rather just adds another property on the exception |
| function onAbortListener() { | ||
| abortChildProcess(child, killSignal); | ||
| abortChildProcess(child, killSignal, options.signal.reason); | ||
| } |
There was a problem hiding this comment.
nit: accessing options.signal.reason can potentially throw though I don't think we guard against that anywhere else to be honest.
There was a problem hiding this comment.
Ah I see, why does it throw tho? I have never seen it like that, is there any way to guard?
There was a problem hiding this comment.
It could be a getter that throws. To guard it against that, we would need a try/catch:
letreason;try{({ reason }=options.signal);}catch{}abortChildProcess(child,killSignal,reason);If we don’t guard against that anywhere else, it’s probably OK to ignore for this PR, but we should do it in a follow up PR IMHO.
There was a problem hiding this comment.
Hmm i check no where else it guarded maybe we could do a larger refactor in a followup
debadree25
commented
May 7, 2023
Oh ok so removing the semver-major then @benjamingr |
Co-authored-by: Darshan Sen <raisinten@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
May 8, 2023
nodejs-github-bot
commented
May 8, 2023
Landed in 2dc4290 |
Fixes: nodejs#47814 PR-URL: nodejs#47817 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Fixes: #47814