-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
MessagePort can send messages after closed #42296
Comments
Hi @jrvidal In this case the method If you execute the next code you can see the log 'hey' has shown before than log 'close'.
You can see this docs on https://nodejs.org/api/worker_threads.html#portclose. |
Thanks, the docs are somewhat ambiguous about this point, that's why I reported. I think it'd be desirable to more closely align with browsers here, or at least be more explicit about this behavior in the documentation. |
#42357 aligns the behavior with the expectations described here and the behavior described for Chrome and Firefox. |
@Trott Thanks for that PR! Any intent to backport to 16.x? |
Node.js v16.x is on Active LTS mode; unless a git conflict arises, it should be backported "automatically" after the adequate maturation delay, see node/doc/contributing/backporting-to-release-lines.md Lines 22 to 25 in a199387
|
Fixes: nodejs#42296 PR-URL: nodejs#42357 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fixes: nodejs#42296 PR-URL: nodejs#42357 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Version
v17.7.1
Platform
Linux 5.13.0-30-generic #33~20.04.1-Ubuntu SMP Mon Feb 7 14:25:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
worker_threads
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Consistently in v17.7.1, v16.14.0 and v14.19.0.
What is the expected behavior?
The program should not log anything, since
port2
is closed right before the call topostMessage
.What do you see instead?
The program does log
hey
.Additional information
For whatever is worth, both in Chrome (Chromium 98.0.4758.102, V8 9.8.177.11) and Firefox (97.0.2), the message never arrives.
The text was updated successfully, but these errors were encountered: