Stream: wasmtime

Topic: ✔ How to recover from a trap


view this post on Zulip Ari Seyhun (Dec 01 2023 at 09:16):

If my wasm module / component traps, is there a simple way to recover from this? Or do I need to load the component from file again, add linker items, and create a new store?

view this post on Zulip Ari Seyhun (Dec 01 2023 at 09:17):

Or maybe just reinstantiate the module only?

view this post on Zulip Ramon Klass (Dec 01 2023 at 10:44):

I don't know if you have to "reboot" the component when it crashed but you can use the instantiate_pre functions to parse and prepare the module but not yet run it, the returned struct can then be instantiated many times with minimum overhead

view this post on Zulip Till Schneidereit (Dec 01 2023 at 14:19):

traps aren't recoverable, no: they're fatal and leave the store in an undefined state.

As Ramon says though, you can use instantiate_pre to make instantiation much much faster

view this post on Zulip Ari Seyhun (Dec 01 2023 at 14:20):

Thanks! I went with the instantiate_pre approach and it worked great :)

view this post on Zulip Notification Bot (Dec 01 2023 at 14:20):

Ari Seyhun has marked this topic as resolved.


Last updated: Dec 23 2024 at 13:07 UTC