-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Transaction crash #7788
Comments
Hi @michalrentka I took a look at your repo and see that the Realm is not confined to the queue that is set for |
Thanks @leemaguire! I completely missed that part, shame on me. Is it ok to write to Realm from multiple background queues or would you recommend creating a separate queue and synchronize all writes to that queue? I'll test your suggestion and see whether I can reproduce or we have more reports. Edit: Actually I re-checked. The write is happening on |
I am seeing a few crashes with a very similar stacktrace. One common thing I could see for these crash reports was that there was a trace that the realm was supposed to be compacted. Maybe realm compaction has something to do with this?
|
@michalrentka , |
@pavel-ship-it thanks for pointing that out. I thought it's not mandatory to use that parameter. I'll update my code to confine all |
➤ Finn Andersen commented: @michalrentka - did it fix your problem? |
@finnschiermer we didn't release this into the wild yet, but I didn't see any similar crashes in beta testing, so this is most likely solved by those changes. I think we can close this issue. |
How frequently does the bug occur?
Sometimes
Description
Users complain that even though no specific action can reproduce this issue, inevitably the app will crash after some time of usage. The app has a sync functionality, so it processes data in the background queue, while the user is using the app, so that's why users might feel that way.
All Realm writes are made in background queues. In background queue all realms are created and all realm actions are performed in an
autoreleasepool
block. The realm is invalidated after write. The realm file is accessed only from the main app.The realm wrapper can be found here: https://github.com/zotero/zotero-ios/blob/master/Zotero/Controllers/Database/RealmDbStorage.swift
Stacktrace & log output
Can you reproduce the bug?
Yes, sometimes
Reproduction Steps
Perform enough writes to realms in background queues until the app crashes.
Version
10.25.1
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
iOS 15.4.1
Build environment
Xcode version: 13.3
Dependency manager: SwiftPM
The text was updated successfully, but these errors were encountered: