Stream: wit-bindgen

Topic: Locks held over state in imported functions


view this post on Zulip Karl Smit (Feb 25 2025 at 23:40):

Hello

I have a small wit world that imports two functions, execute and query.

I am setting my state to hold a struct that provides wgpu operations and binding those to the above imports.

When running the operations outside of the wasm environment it works, however when calling the imported versions wgpu panics telling me about attempting to recursively acquire snatch locks.

Im wondering if there is some detail about the way that setting imports for a world in the host environment is messing with the held locks.

I attempted to instead have my world state hold an Arc<RwLock<Kernel>> instead but I get the same thing.

Is there anything I should know about what gets passed into the world state?

Thank you

view this post on Zulip Alex Crichton (Feb 26 2025 at 16:09):

In theory wit-bindgen/etc have nothing to do with locks and it should look pretty standard, so I'm not sure where this might be coming from

view this post on Zulip Alex Crichton (Feb 26 2025 at 16:10):

Not that there couldn't be a bad interaction with wgpu and components/etc, but nothing that jumps to mind at least


Last updated: Feb 28 2025 at 03:10 UTC