-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Repl Crashes in infinite Async recursion #40502
Comments
@nodejs/repl |
Pressing enter crashes the REPL with newer versions. This is likely an issue due to top level away support? |
When building on master it is crashing without pressing enter as well @BridgeAR . |
On further deep-dive it seems TCO (Tail call optimisation) is not kicking in. To verify this hypothesis i have written a simple script 'use strict';
const fn = (a) => {
a(a);
}
fn(fn); On executing the above script it is always erroring out with
|
V8 doesn't implement TCO. |
Then isn't the expected behaviour in the issue template seems wrong? |
One more thing if you change the snippet just slightly. (async (a) => process.nextTick(() => a(a)))(async (a) => process.nextTick(() => a(a))) It won't crash the repl as stack won't exceed but might end up in the following error: > RangeError: Map maximum size exceeded
at Map.set (<anonymous>)
at AsyncHook.init (node:domain:76:15)
at emitInitNative (node:internal/async_hooks:201:43)
at emitInitScript (node:internal/async_hooks:506:3)
at promiseInitHook (node:internal/async_hooks:321:3)
at promiseInitHookWithDestroyTracking (node:internal/async_hooks:325:3)
at REPL1:1:45
at REPL1:1:81
at processTicksAndRejections (node:internal/process/task_queues:77:11)``` |
Version
v16.1.0
Platform
Linux linx-PC 5.8.0-63-generic #71-Ubuntu SMP Tue Jul 13 15:59:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
Repl
What steps will reproduce the bug?
(async (a)=>a(a))(async (a)=>a(a))
but don't press returnHow often does it reproduce? Is there a required condition?
100% of the time.
What is the expected behavior?
The repl should not crash.
What do you see instead?
Additional information
Typing
(a=>a(a))(a=>a(a))
doesn't crash and only prints the error after you press enter.The text was updated successfully, but these errors were encountered: