mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-12 02:37:53 -04:00
2bff8d617e
# Description of Changes Fixes the deadlock in procedures due to holding tx lock across `async` abis. More info can be found here - https://discordapp.com/channels/931210784011321394/1011381307965722774/1458432377574658060. This patch converts following procedure abis from `async` to sync, which may seem problematic but it's not as we already hold tx locks in reducers while blocking the worker thread. ```rust "spacetime_10.3"::procedure_start_mut_tx, "spacetime_10.3"::procedure_commit_mut_tx, "spacetime_10.3"::procedure_abort_mut_tx, ``` # API and ABI breaking changes: I am surprised that this does not turned out to be ABI breaking change. Maybe because from wasm side, async abis were always treated as synchoronous. # Expected complexity level and risk 2, diff is straightforward but it can have hidden implications. # Testing I want someone else to also do the similar testing as mine. Just in case, I missed something and that appeared it to work. I did the backward compatible testing as following: 1. I published following module on master branch: ```rust use spacetimedb::{ProcedureContext, Table}; #[spacetimedb::table(name = my_table)] struct MyTable { a: u32, b: u8, } #[spacetimedb::procedure] fn insert_a_value(ctx: &mut ProcedureContext, a: u32, b: u8) { ctx.with_tx(|ctx| { ctx.db.my_table().insert(MyTable { a, b }); }); } ``` 2. Called a procedure to insert some values: `spacetime call quick insert_a_value 1 2` 3. Switched to my branch, re-compiled and restarted the server. 4. Called a procedure again with different values, verfied both old and new values are present. --------- Signed-off-by: Shubham Mishra <shivam828787@gmail.com> Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>