8000 The Realm is already in a write transaction · Issue #6991 · realm/realm-js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

The Realm is already in a write transaction #6991

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

Open
feidaZhang opened this issue Apr 8, 2025 · 1 comment
Open

The Realm is already in a write transaction #6991

feidaZhang opened this issue Apr 8, 2025 · 1 comment

Comments

@feidaZhang
Copy link

How frequently does the bug occur?

Sometimes

Description

I use realm in a reactnative project. My users encounter the issue sometimes. They must reopen app to fix it.
I always use write function to save data. like this, the exception is catched.

  public static saveTransaction(entity: any) {
    try {
      RealmManager.getRealmInstance().write(() => {
        RealmManager.getRealmInstance().create('Transaction', entity, UpdateMode.All);
      });
      return true;
    } catch (exception) {
      // upload log
      return false;
    }
  }

Findings

I am sure that no mutiple transactions at the same time because i only use one realm instance in the JS thread.
I realize that the issue happens if the device has low available storage on Android.
Some memory issues can also lead to the issue, eg can not allocate memory on iOS.

Questions

  • Should i let the app crash instead of catching the exception thrown by write?
  • What are the reasons of memory issues from realm on iOS? That has to reopen app and fix it.
    • mmap() failed: Cannot allocate memory size: 1048576 offset: 60817408
    • std::bad_alloc
  • Why do we put commitTransaction outside of the try block? The cancelTransaction may not be called rightly. In the comment, commitTransaction is catched. It has some confusion.
    write function
    write function
    comment on beginTransaction
    comment on beginTransaction

Stacktrace & log output

Can you reproduce the bug?

Sometimes

Reproduction Steps

No response

Version

12.6.2

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS and Android

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

@kdirectoryxo
Copy link

Also facing same issue here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0