Open noahgibbs opened 3 months ago
It's possible that we're generating an RbFatalError on the JS side (ref: https://www.npmjs.com/package/@ruby/wasm-wasi). If so, might be possible to catch it and reload. That would lose any data in Ruby mem, of course.
I haven't seen this, including in calc.html, since I got rid of the JS-based DOM modification and replaced with the JS gem. I also made sure an element exists in the DOM before trying to modify it in all cases. So maybe this is fixed.
I'll consider it provisionally fixed for now, and update this issue if I see it again.
Looks like a very similar error can occur when you keep touching objects after shutdown: #5
Often while a SpaceShoes app is running, we'll get a function with mismatched type error when attempting to report the Ruby VM state. It's possible this is a ruby.wasm error that will get worked out upstream, or even an emscripten error -- there's one that looks similar.
It's also possible we're doing something wrong that causes this. File operations like fwrite seem to be easy to misuse in a way that can cause it, though the error happens even in Shoes apps that use no additional files. (Huh, maybe I should remove the file loader since we usually don't need it?)
This issue is a place to dump information about this bug as we go along.
For instance, it will often occur after the Shoes app has been running awhile, many heartbeats in. So it doesn't seem to be immediately triggered by something new that just happened a moment ago. There seems to be some built in randomness or delay.