Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
139 stars 2 forks source link

Dump worlds and exit Resonite when userspace crashes #2779

Closed JackTheFoxOtter closed 2 weeks ago

JackTheFoxOtter commented 2 months ago

Is your feature request related to a problem? Please describe.

When an unhandled exception is thrown in the userspace world, it results in userspace crashing and closing. This leaves you without a dashboard primarily, but has other side-affects, from my observation breaking your lasers and freezing the game when you try to shut it down. Without userspace, Resonite is not fully operational.

Describe the solution you'd like

I would like an automatic recovery mechanism that attempts to restart userspace in case of it closing. One additional thing to consider here is what to do if userspace crashes continuously, for example because of a faulty facet which was already saved to your workspace causing exceptions on load. It would be good if the game itself could detect such a "boot loop" and prompt the user with the option to reset userspace if it crashes multiple times in a row.

Describe alternatives you've considered

I don't think there are many. Without userspace the game isn't fully operational. A userspace crash could bring down the entire client, but that might make the situation even worse.

Additional Context

This happened to me because of faulty ProtoFlux on a WIP facet. I was able to recover it, but only because the facet didn't throw the exception imediately on load, and I already had custom facets in userspace to access a dev tool. Without those I wouldn't have been able to recover without at least a full dash reset.

Requesters

No response

Frooxius commented 2 months ago

I don't think this is something we can safely do.

Unhandled crashes can be anything and they can leave shared Userspace resources in a state, that makes it unsafe to reinitialize it.

E.g. Consider it reinitialize, but now saving items is silently broken. You keep going about your business, only to find you lost all work next time.

The only safe thing I can see us doing is dump the state of worlds to drive and shut down the process.

JackTheFoxOtter commented 2 months ago

Yeah that's a good point. In either case though I think the current behavior isn't very desirable, since that leaves the application running without the ability to interact with the game at all, or even shut it down properly.

JackTheFoxOtter commented 2 months ago

I also believe the dumping of world state is very useful, but has extremely poor discoverability for non-technical users. Do you think it could be possible to create a more user friendly UI for managing / loading dumped worlds? If that's possible I'd make a separate issue for that.

Frooxius commented 2 months ago

It's possible, but it's a lot of extra work, which makes this issue a lot less likely to be prioritized if you want that to be done together.

JackTheFoxOtter commented 2 months ago

No, it's a separate issue, they are unrelated. I'll make one.

JackTheFoxOtter commented 3 weeks ago

The only safe thing I can see us doing is dump the state of worlds to drive and shut down the process.

Updated title to reflect this.

Frooxius commented 2 weeks ago

I've implemented this in 2024.10.8.1349, thanks!