-
Notifications
You must be signed in to change notification settings - Fork 17.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
runtime: corruption after wasm stack overflow RangeError #70829
Comments
/cc @golang/wasm |
This comment was marked as outdated.
This comment was marked as outdated.
#70829 (comment) looks like there is indeed a deep recursion. At |
In non-web Ivy I measured the call depth at 25,573, corresponding to 4X that in Go frames. Playing with Ivy's
is right around the line where it stops working reliably. Sometimes I see things like "fatal: sched holding locks", which makes me think that the problem is that when the stack overflow happens, the wasm runtime just unwinds the stack, but the Go code has not had a chance to clean up. So it might be holding locks, didn't run defers, and so on. And perhaps the goroutine gets reused for the next call. I'm starting to believe more strongly that the RangeError needs to be handled by wasm_exec and have it just tear down Go entirely. |
It looks like |
_resume() {
if (this.exited) {
throw new Error("Go program has already exited");
}
try {
this._inst.exports.resume();
} catch (err) {
if (err instanceof RangeError) {
// runtime.throw
this._inst.exports.throw(err.message);
this.exited = true;
this._resolveExitPromise();
throw err;
}
}
if (this.exited) {
this._resolveExitPromise();
}
} I was able to catch |
Change https://go.dev/cl/636315 mentions this issue: |
Open https://swtch.com/tmp/wasmbug/ in Chrome.
Open the developer console (right click on page, Inspect, then click the Console tab).
It should say "Go starting".
Now click Run.
You should see an "Uncaught RangeError: Maximum call stack size exceeded":
I'm a little surprised that it shows this stack and not a stack inside user code if the stack is too big. Perhaps this is the "m" stack and it is not supposed to be overflowing?
I am not sure whether Go is expected to continue at this point, but it seems to still be running. Click Run again.
Now you should see a fatal error like this:
As I said, it is unclear to me whether the bug is the original RangeError or that it can't continue after the RangeError.
To reproduce:
The text was updated successfully, but these errors were encountered: