mod_wasm icon indicating copy to clipboard operation
mod_wasm copied to clipboard

Better management for Poisoned Locks

Open gzurl opened this issue 2 years ago • 1 comments

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

Currently, if a lock is poisoned on the Rust side, the code will panic. We might want to improve this behavior by returning an error.

See the original discussion at https://github.com/vmware-labs/mod_wasm/pull/41#discussion_r1154193853

Since there is some literature written and different options about how to deal with poisoned locks, I'm opening this issue for an open discussion.

Describe the solution you'd like

@ereslibre suggested:

let mut executionctxs = WASM_RUNTIME_EXECUTIONCTXS.write().map_err(|e| format!("error: {:?}", e))?;

Describe alternatives you've considered

No response

Additional context

No response

gzurl avatar Mar 31 '23 10:03 gzurl

let mut executionctxs = WASM_RUNTIME_EXECUTIONCTXS.write().map_err(|e| format!("error: {:?}", e))?;

This is just if we keep Result<String, String>, that I think we should change to Result<String, ErrorTypes>, so that consumers don't need to process strings in errors, but can use a specific type such an enum providing better error feedback.

ereslibre avatar Mar 31 '23 10:03 ereslibre