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

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

Open
izik1 opened this issue Sep 24, 2024 · 0 comments
Open

Comments

@izik1
Copy link

izik1 commented Sep 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant