Skip to content

build_backtrace called too often on stack unwinding #904

@bnoordhuis

Description

@bnoordhuis
function f() { f() } let count = 0 Error.prepareStackTrace = () => count++ try { f() } catch (e) { // ignore } print(count) // prints ~157, increases with bigger --stack-size

It's due to the build_backtrace call in JS_CallInternal that's called every time a stack frame is unwound.

Another way of demonstrating the issue:

function f(n) { if (--n > 0) f(n) else throw Error("unwind") } Error.prepareStackTrace = (exc, stk) => print(stk.length) try { f(16) } catch (e) { // ignore }

Prints:

10 10 10 10 10 10 10 10 10 9 8 7 6 5 4 3 2 1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions