Add an already-called error to run for wasip3.#74
Conversation
Define a `run` error type and use it in the `run` function, to allow programs to report an error instead of trapping if their `run` function is called more than once.
| error, | ||
|
|
||
| /// The `run` function has already been called in the callee's instance. | ||
| already-called |
There was a problem hiding this comment.
It seems that this error case would be returned only in scenarios where the caller is malfunctioning.
If the caller is the host runtime, then that means that the host has instantiated the component, called run on it once and then called it again using the same store - effectively, the guest would signal to the host that the host's implementation has a bug. Is there a way that the host can handle this error and recover in any way?
Similarly, and IMO, more rare usage of this, would be a component composition, where a component is calling run on another component. Similarly, since this is a logical error, is there any reasonable recovery mechanism the caller can use if it receives already-called?
Looking at it from another perspective, every guest toolchain would need to track this state and return this error if run is called more than once. Are we confident that every toolchain would actually do that and return this error? In other words, can callers reliably assert that if a run() has returned error::error that it is not "caller's fault"?
Overall, I am struggling to find a use case for this error case, could you perhaps provide some examples of how this could be used?
|
Thank you for contributing to WASI! As part of our proposal management process, we decided to consolidate all phase 3 proposals into a single monorepo at WebAssembly/wasi to better manage the proposals that have reached phase 3. We have completed migrating all phase 3 proposals to WebAssembly/wasi including their issues, but PRs need to be re-opened in the new repository. This is a GitHub limitation and we're sorry for the inconvenience. Please re-open this PR on WebAssembly/wasi. Thank you! |
Define a
runerror type and use it in therunfunction, to allow programs to report an error instead of trapping if theirrunfunction is called more than once.