-
Type: Bug
-
Resolution: Cannot Reproduce
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
All the time
Description
I am experiencing a similar issue to https://github.com/realm/realm-js/issues/2434.
Where I do something like
async function trySendMessage(message) { try { await sendMessage(message); } catch (error) { await handleError(error); } } async function sendMessage(message) { await doSendMessage(message); } async function handleError(message, error) { realm.write(() => { message.error = error; // ❌ ❌ JS task hangs on this line and never continues. The message is never updated in realm. }); }
by refactoring to
async function trySendMessage(message) { try { await sendMessage(message); } catch (error) { console.log(error); } } async function sendMessage(message) { try { await doSendMessage(message); } catch (error) { realm.write(() => { message.error = error; }); } }
Realm seems to have some issues with async functions see https://github.com/realm/realm-js/issues/4375 . Could this be related to JSI hanging issues? https://github.com/facebook/react-native/issues/33006
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
I appreciate the sample code is not a fully reproducible example so it's okay if this issue gets closed. However, I imagine the core developers might have seen an issue like this before and might be able to provide workarounds.
Version
10.20.0-beta.2
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
ios
Build environment
Which debugger for React Native: ..
Cocoapods version
No response