-
Notifications
You must be signed in to change notification settings - Fork 58
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
How to catch stack overflow? #141
Comments
I think we might have run into this with stdweb... https://github.com/benkonz/texture_issue/pull/1#issuecomment-382498172 |
yes it would be awesome to know how to debug this thing |
Maybe Rust could have a special compiler flag that introduces additional stack overflow checks and panics if it detects one. |
@CryZe Yeah, that's definitely a good idea, even if it would be opt-out. |
I think we should change the memory layout constructed by |
Yeah I do think that it's probably best to just change the default layout at this time. One unfortunate part is that it's still not easy to diagnose (a "segfault" and stack overflow look exactly the same). I think the only way we could handle that currently, though, would be to add a condition on all function calls that checks the current stack pointer (which may have a perf hit) |
I believe this was covered by |
Hey guys! I've been struggling with trying to detect (in JS) when a stack overflow occurs in my rust code (wasm). I see this issue has been closed for a while, but I'm not sure how to fix this myself. I'm hoping to be able to know when this happens, as well as when Exceptions like this happen:
Is this possible or no? Currently the promise that is returned from WASM just never resolves, which leaves the user spinning forever. Any ideas? |
@pjtatlow |
Occasionally from time to time you'll accidentally write a deeply recursive function which blows the stack. Ideally this is caught and identified immediately, but sometimes a stack overflow can cause crazy corruption throughout the system and be otherwise very hard to debug.
Currently there's no mechanism for catching a stack overflow with wasm, and a stack overflow ends up corrupting the globals section most likely (oh dear!).
The text was updated successfully, but these errors were encountered: