Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wasm panic caused by a race condition in IotaDocument and CoreDocument #1258

Merged
merged 5 commits into from
Nov 2, 2023

Conversation

abdulmth
Copy link
Contributor

Description of change

fixes ##1150

This PR change the methods requiring read/write to be fallible if the lock is acquired to prevent uncontrolled crashes, since blocking is not supported for RwLock in wasm.

@abdulmth abdulmth self-assigned this Oct 18, 2023
@abdulmth abdulmth added Bug Something isn't working. Wasm Related to Wasm bindings. Becomes part of the Wasm changelog labels Oct 18, 2023
@abdulmth abdulmth added this to the v1.0 Features milestone Oct 18, 2023
@abdulmth abdulmth added the Patch Change without affecting the API that requires a patch release. Part of "Patch" section in changelog label Oct 18, 2023
@olivereanderson
Copy link
Contributor

Great that you tackled this! It might be an idea to include a typescript test that asserts an error is thrown in the scenario described in this comment

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I think that's the most reasonable way to deal with this.

If I do a Promise.all on multiple promises each of which does a createJws (so an async read), that should be fine because it would use asynchronous rather than synchronous locking, right? That's how I understood #1150.

bindings/wasm/tests/storage.ts Outdated Show resolved Hide resolved
bindings/wasm/tests/storage.ts Outdated Show resolved Hide resolved
@abdulmth
Copy link
Contributor Author

If I do a Promise.all on multiple promises each of which does a createJws (so an async read), that should be fine because it would use asynchronous rather than synchronous locking, right?

yes that's true.

@abdulmth abdulmth requested a review from eike-hass October 26, 2023 16:16
@eike-hass eike-hass merged commit 867cb9d into main Nov 2, 2023
8 checks passed
@eike-hass eike-hass deleted the fix/panic-on-concurrent-operations-in-documents branch November 2, 2023 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working. Patch Change without affecting the API that requires a patch release. Part of "Patch" section in changelog Wasm Related to Wasm bindings. Becomes part of the Wasm changelog
Projects
Development

Successfully merging this pull request may close these issues.

4 participants