-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Hanging when using MessagePort
from ES customization hooks via --import
#52846
Comments
@nodejs/loaders please correct me if I'm wrong. EDIT: tried that now, seems wrong. but you could
|
Thank you @dygabo! I am happy to add a PR to update the example in the node docs (https://nodejs.org/api/module.html#initialize) so others don't encounter this. |
yes, it should be enough to |
When running these examples, `node` fails to return as this `MessagePort` keeps the event loop active in the main thread unless it is `unref()`ed. Fixes: nodejs#52846
When running these examples, `node` fails to return as this `MessagePort` keeps the event loop active in the main thread unless it is `unref()`ed. Fixes: nodejs#52846
When running these examples, `node` fails to return as this `MessagePort` keeps the event loop active in the main thread unless it is `unref()`ed. Fixes: #52846 PR-URL: #53637 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
When running these examples, `node` fails to return as this `MessagePort` keeps the event loop active in the main thread unless it is `unref()`ed. Fixes: #52846 PR-URL: #53637 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
When running these examples, `node` fails to return as this `MessagePort` keeps the event loop active in the main thread unless it is `unref()`ed. Fixes: #52846 PR-URL: #53637 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
When running these examples, `node` fails to return as this `MessagePort` keeps the event loop active in the main thread unless it is `unref()`ed. Fixes: #52846 PR-URL: #53637 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Version
v21.1.0
Platform
Microsoft Windows NT 10.0.22631.0 x64
Subsystem
No response
What steps will reproduce the bug?
Running
node --import ./bootstrap.mjs ./index.mjs
will hang with the following code.How often does it reproduce? Is there a required condition?
Reproducible 100% of the time.
What is the expected behavior? Why is that the expected behavior?
For
node
to printand return normally.
What do you see instead?
node
hangs, but prints the expected to the consoleAdditional information
node
returns normally and no longer hangs ifport.close()
is added afterport.postMessage('initialize');
,port1.on('message', ...)
This code was taken and simplified from the example in the documentation here https://nodejs.org/api/module.html#initialize.
The text was updated successfully, but these errors were encountered: