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

"clearImmediate" results in an abort #37806

Closed
zyscoder opened this issue Mar 19, 2021 · 1 comment · Fixed by #37824
Closed

"clearImmediate" results in an abort #37806

zyscoder opened this issue Mar 19, 2021 · 1 comment · Fixed by #37824
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

Comments

@zyscoder
Copy link

What steps will reproduce the bug?

Setup a node instance,

» node

and run the following javascript code.

clearImmediate({hasRef: true, _onImmediate: 100000000000000000})

Then an abort occurs.

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

This abort can always be triggered following the steps above.

What is the expected behavior?

If any error occurs, an exception or other similar error-reporting stuff should be thrown. There is no reason to abort the whole node process.

What do you see instead?

» node
Welcome to Node.js v14.15.1.
Type ".help" for more information.
> clearImmediate({hasRef: true, _onImmediate: 100000000000000000})
node[65197]: ../src/async_wrap.cc:623:static void node::AsyncWrap::QueueDestroyAsyncId(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[0]->IsNumber()' failed.
 1: 0xa03530 node::Abort() [node]
 2: 0xa035ae  [node]
 3: 0x979ceb node::AsyncWrap::QueueDestroyAsyncId(v8::FunctionCallbackInfo<v8::Value> const&) [node]
 4: 0xbe369b  [node]
 5: 0xbe4c46  [node]
 6: 0xbe52c6 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
 7: 0x13ff259  [node]
[1]    65197 abort (core dumped)  node

Additional information

@aduh95 aduh95 added repl Issues and PRs related to the REPL subsystem. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. labels Mar 19, 2021
@aduh95
Copy link
Contributor

aduh95 commented Mar 19, 2021

It seems to be REPL only, the process doesn't crash when executing a file or using eval.

$ node -e 'clearImmediate({hasRef: true, _onImmediate: 100000000000000000})'
internal/timers.js:278
    item._idleNext._idlePrev = item._idlePrev;
                             ^

TypeError: Cannot set property '_idlePrev' of undefined
    at ImmediateList.remove (internal/timers.js:278:30)
    at clearImmediate (timers.js:324:18)
    at [eval]:1:1
    at Script.runInThisContext (vm.js:133:18)
    at Object.runInThisContext (vm.js:310:38)
    at internal/process/execution.js:77:19
    at [eval]-wrapper:6:22
    at evalScript (internal/process/execution.js:76:60)
    at internal/main/eval_string.js:23:3

I'm able to reproduce the crash on master branch when executing the given instruction on REPL.

@aduh95 aduh95 added the confirmed-bug Issues with confirmed bugs. label Mar 19, 2021
Linkgoron added a commit to Linkgoron/node that referenced this issue Mar 19, 2021
Fix errors that are caused by invoking clearImmediate
with arbitrary objects.

fixes: nodejs#37806
Linkgoron added a commit to Linkgoron/node that referenced this issue Mar 20, 2021
Fix errors that are caused by invoking clearImmediate
with arbitrary objects.

fixes: nodejs#37806
@aduh95 aduh95 closed this as completed in fcc934f Mar 28, 2021
ruyadorno pushed a commit that referenced this issue Mar 29, 2021
Fix errors that are caused by invoking clearImmediate
with arbitrary objects.

fixes: #37806

PR-URL: #37824
Fixes: #37806
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
ruyadorno pushed a commit that referenced this issue Mar 30, 2021
Fix errors that are caused by invoking clearImmediate
with arbitrary objects.

fixes: #37806

PR-URL: #37824
Fixes: #37806
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this issue May 1, 2021
Fix errors that are caused by invoking clearImmediate
with arbitrary objects.

fixes: #37806

PR-URL: #37824
Fixes: #37806
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.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. repl Issues and PRs related to the REPL subsystem. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants