-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
worker: do not throw on property access or postMessage after termination #25871
Conversation
CI: https://ci.nodejs.org/job/node-test-pull-request/20512/ /cc @nodejs/workers |
I don't know, it seems better to me if they continue to exist, but are closed. EDIT: sorry, ignore this. I thought this was the cluster Worker, but its not. I have no opinion on WebWorkers. The API is supposed to be standardized, does the standard not address this? |
I edited my comment above, but then remembered edits don't cause notifications. See ----^ |
@sam-github, I'm not sure what the standard says, but chromium 71 fails silently when calling
|
Mmm, will modify to make the linter happy. |
Should be fixed. I can squash and push again if that's preferred. |
|
||
// Sanity check. | ||
assert.strictEqual(w.threadId, -1); | ||
assert.strictEqual(w.stdin, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this also checks that w.stdin
does not throw. Can the one above be removed?
@chjj I think @sam-github’s suggestion for stdio was to make the getters not throw by removing the |
Resume CI: https://ci.nodejs.org/job/node-test-pull-request/20625/ If this isn’t addressed in this PR, I think I’d like to land this and then apply @sam-github’s suggestion and make sure one PR doesn’t get released without the other. |
PR-URL: nodejs#25871 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: James M Snell <jasnell@gmail.com>
This addresses review comments from nodejs#25871. Refs: nodejs#25871
PR-URL: #25871 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: James M Snell <jasnell@gmail.com>
Worker#postMessage
,Worker#stdin
,Worker#stdout
, andWorker#stderr
currently throw if called/accessed after a worker is terminated.postMessage
silently fails in the browser after termination. It also seems cleaner if the stdio streams are set tonull
after termination. This PR implements that behavior.