Skip to content
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_threads.receiveMessageOnPort' results in an abort #32742

Closed
zyscoder opened this issue Apr 9, 2020 · 0 comments
Closed

'worker_threads.receiveMessageOnPort' results in an abort #32742

zyscoder opened this issue Apr 9, 2020 · 0 comments
Labels
confirmed-bug Issues with confirmed bugs. worker Issues and PRs related to Worker support.

Comments

@zyscoder
Copy link

zyscoder commented Apr 9, 2020

  • Version:v12.16.0
  • Platform:Linux vul337 4.15.0-91-generic new design of error handling #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: process

What steps will reproduce the bug?

Directly run the following code snippet using node:

require('worker_threads').receiveMessageOnPort(0)

How often does it reproduce? Is there a required condition?

No. This potential bug can always be reproduced.

What is the expected behavior?

The argument to 'worker_threads.receiveMessageOnPort' should be a 'MessagePort' object, but we passed an integer value into it. The function should throw an exception or other similar error-reporting stuff rather than crash the whole nodejs process.

What do you see instead?

This is the stack dump produced during abort:

./node[17081]: ../src/node_messaging.cc:878:static void node::worker::MessagePort::ReceiveMessage(const FunctionCallbackInfo<v8::Value> &): Assertion `args[0]->IsObject()' failed.
 1: 0x13f9b30 node::Abort() [./node]
 2: 0x13f9709  [./node]
 3: 0x148b6c0 node::worker::MessagePort::ReceiveMessage(v8::FunctionCallbackInfo<v8::Value> const&) [./node]
 4: 0x17b379c v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [./node]
 5: 0x17b23d5  [./node]
 6: 0x17b1092  [./node]
 7: 0x2717a59  [./node]
[1]    17081 abort      ./node

Additional information

@addaleax addaleax added confirmed-bug Issues with confirmed bugs. worker Issues and PRs related to Worker support. labels Apr 9, 2020
addaleax added a commit to addaleax/node that referenced this issue Apr 9, 2020
Use the same type check we use in `MoveToContext()` in
`ReceiveMessage()`.

Fixes: nodejs#32742
BethGriggs pushed a commit that referenced this issue Apr 14, 2020
Use the same type check we use in `MoveToContext()` in
`ReceiveMessage()`.

Fixes: #32742

PR-URL: #32745
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
targos pushed a commit to targos/node that referenced this issue Apr 25, 2020
Use the same type check we use in `MoveToContext()` in
`ReceiveMessage()`.

Fixes: nodejs#32742

PR-URL: nodejs#32745
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
BridgeAR pushed a commit that referenced this issue Apr 28, 2020
Use the same type check we use in `MoveToContext()` in
`ReceiveMessage()`.

Fixes: #32742

PR-URL: #32745
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
targos pushed a commit that referenced this issue Apr 28, 2020
Use the same type check we use in `MoveToContext()` in
`ReceiveMessage()`.

Fixes: #32742

PR-URL: #32745
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants