Skip to content

Abi-checking uses unbounded recursion leading to debug-profile stack-overflow #119

@izik1

Description

@izik1

Specifically check_inner. Via some println debugging (and using stacker) I've discovered that our closed source application stack overflows in check inner after it's recursively called at least 24 times.

Each recursion uses about 15kb-20kb of stack space which... Seems like a lot quite honestly, even for debug mode. With opt-level=1 in [profile.dev.package.abi_stable] it shrinks to about 1.5kb of stack space per recursion.

Our call stack is a lot deeper by the time we call into abi-stable (init_root_module specifically), so instead of having about 2mb of stack (which happens if we cargo test and call it fairly high up) we have...0.5ish (and indeed, at a recursive depth of 24 or so, 0.5 MBs of stack space is used, if we're using the higher estimate of 20kb).

I believe this is a bug because -Copt-level=1 shouldn't be a correctness requirement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions