-
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
Segmentation Fault on Contextifying MessagePort Transferred to a Worker Thread #49075
Labels
Comments
Hey! Thanks for the report, and the repro case is really good, I'm gonna work on this one :-) |
The problem seems to be the context.messagePort = workerData.crash ? workerData.messagePort : messageChannel.port2 I'm investigating a bit more, and send a possible fix for this one |
juanarbol
added a commit
to juanarbol/node
that referenced
this issue
Aug 13, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: nodejs#49075
juanarbol
added a commit
to juanarbol/node
that referenced
this issue
Aug 13, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: nodejs#49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
juanarbol
added a commit
to juanarbol/node
that referenced
this issue
Aug 13, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: nodejs#49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
juanarbol
added a commit
to juanarbol/node
that referenced
this issue
Aug 13, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: nodejs#49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
juanarbol
added a commit
to juanarbol/node
that referenced
this issue
Aug 23, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: nodejs#49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
juanarbol
added a commit
to juanarbol/node
that referenced
this issue
Aug 24, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: nodejs#49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
juanarbol
added a commit
to juanarbol/node
that referenced
this issue
Aug 29, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: nodejs#49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
nodejs-github-bot
pushed a commit
that referenced
this issue
Oct 22, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: #49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: #49150 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
targos
pushed a commit
that referenced
this issue
Oct 23, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: #49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: #49150 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
alexfernandez
pushed a commit
to alexfernandez/node
that referenced
this issue
Nov 1, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: nodejs#49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: nodejs#49150 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
targos
pushed a commit
that referenced
this issue
Nov 11, 2023
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: #49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: #49150 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Version
Platform
Linux WORKSTATION 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Microsoft Windows NT 10.0.19045.0 x64
Subsystem
vm, maybe node:internal/per_context
What steps will reproduce the bug?
MessagePort
Worker
and transfer the message port to the worker.Sample code to reproduce
How often does it reproduce? Is there a required condition?
It always reproduces. It sometimes (on Node 18 on Windows, apparently) requires accessing a property in the contextified port. Otherwise just contextifying the port is enough.
What is the expected behavior? Why is that the expected behavior?
The port is contextified and usable, even across multiple contexts. At worst, an error should occur without crashing or aborting the Node process.
What do you see instead?
Node crashes with a segmentation fault.
Sample output (Node 17)
Sample output (Node 18)
Sample output (Node 19)
Additional information
No response
The text was updated successfully, but these errors were encountered: