-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Started experiencing SIGKILL crashes very frequently after iOS 15 launch #7466
Comments
Could that be due to us using the ancient 10.7.6 version? |
Hi @romanrudyy you will need to give us your crash reports in order for us to help you further. |
Thanks for responding @leemaguire ! We have updated to 10.16, but the crashes seem to keep happening. I'm not fully sure the crashing is caused by Realm, but it seems like a suspect! Thanks! Riot 07.10.2021, 23-04.crash.zip |
@leemaguire thanks! have you had a chance to look at the crash logs :) |
Some more info: Since it's a SIGKILL crash it certainly looks like this realm operation takes too much time or resources. And we have most reports as having something to do with backgrounding the app, e.g.: "I wasn’t getting messages on Discord so I sent a test which went through, and then I switched back to a Facebook conversation, and when I Cmd+Tabbed out of Beeper into Discord, it crashed" "I got a message saying it crashed but I dont see any issues. Nothing user facing that I can see wrong. Actually working great so far" This IMO indicates iOS killing the app for not being able to finish the operation in background. I can't say I'm 100% sure it's realm but it's my best hunch. All crashes have some sort of major realm operation present: opening, closing, resizing: 0 libsystem_kernel.dylib 0x00000001b9024888 close + 8 1 Realm 0x0000000106b52158 realm::util::File::unlock() + 104 0 libsystem_kernel.dylib 0x00000001baa47ad8 msync + 8 1 Realm 0x0000000108933cf8 realm::util::msync(int, void*, unsigned long) + 220 2 Realm 0x00000001087fd5c4 realm::GroupWriter::commit(unsigned long) + 296 0 libsystem_kernel.dylib 0x00000001b8c256e4 ftruncate + 8 1 Realm 0x0000000104ce2c94 realm::util::File::resize+ 3075220 (long long) + 56 0 libsystem_kernel.dylib 0x00000001baa45398 __munmap + 8 1 Realm 0x000000010867f830 realm::util::munmap+ 3094576 (void*, unsigned long) + 500 2 Realm 0x00000001084e70fc realm::SlabAlloc::detach() + 404 3 Realm 0x0000000108525684 realm::DB::close_internal+ 1676932 0 libsystem_kernel.dylib 0x00000001ba0c7df0 __open + 8 1 libsystem_kernel.dylib 0x00000001ba0c81d4 open + 40 (open-base.c:101) 2 Realm 0x0000000106dbf9d8 realm::util::File::lock+ 3078616 (bool, bool) + 780 |
@romanrudyy were you able to find a fix? |
Facing the same issue in my app. All crashes happening on iOS 15 devices only. Exception Type: EXC_CRASH (SIGKILL) Not able to reproduce this issue but this is happening in high numbers |
Seeing the same crashes in ios 15 devices in production, but not able to reproduce it while testing. Please help as the crash numbers are very high |
we are using 10.8.1 |
I am also facing the same issue. This info might help to check the issue:- |
Hmm... I took a look at the crash logs. Nothing sticks out to me, and I've ran our test suite locally on an iOS 15 device. How large is the realm file? Are you using encryption? And notably, if there are locking issues (which it look like there might be), would you be able to detect any permissions issues with the file? |
Size would be more than 400 MB but we are doing compaction also and limit is set to 300 MB can it be the case. |
Is your app part of an app group? Is this work happening when the app is backgrounded? |
Yes we do have app groups. |
@jsflax Yes, app is a part of an app group, and the Realm file is saved in the app group container. And yes, all the crashes are happening when the app is backgrounded. It tends to happen immediately when backgrounding the app and opening another app. |
Also faced with same issue. I've found that in my case crashes happens on obj-c apps, but not happens on swift apps. |
To anyone else seeing this issue - I think moving the Realm file to the main document directory rather than the app group container fixed the issue. (Not fully confirmed, but anecdotally have been seeing fewer background crashes in the last ~3 days since attempting it). Essentially, before initializing Realm on app launch, I perform a 1 time move operation of the Realm file to the main document directory, kind of like this: let containerDirectory = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Constants.sharedContainerIdentifier)
let documentsDirectory = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
if let oldContainerRealmURL = containerDirectory?.appendingPathComponent("app.realm") &&
let realmUrl = directory?.appendingPathComponent("app.realm") &&
FileManager.default.fileExists(atPath: oldContainerRealmURL.path) {
try? FileManager.default.moveItem(atPath: oldContainerRealmURL.path, toPath: realmUrl.path)
}
// Initialize realm with the new realm URL here |
I have a very basic default setup, not storing Realm in app group container and still facing those crashes
|
Same we also have Realm file in main Document directory still our app is crashing. Previously we had old version of Realm file 4.4.1. |
Same here, as reported here: https://developer.apple.com/forums/thread/693623 |
Not the same problem, @JituDeore is talking about crash on launch and not about crash on background. |
To simply put - When realm is upgraded from 4.* to 10.*, there is a format change in realm. Due to this the realm file is copies to the new format and this takes time on launch. Time out occurs and app crashes for a lot of users. What can we do to avoid this long delay ? |
Hi all, How to:
The crashlog could be found in XCode's Devices and Simulators window. Pleae let me know if that works for you. |
@romanrudyy hi. any news on the issue? Can you reproduce the issue using the approach from my previous message? |
Hi all. Is there any information? Still facing hundreds of crashes every day. Can't see them in firebase, but they are visible in AppStoreConnect dashboard and XCode organizer |
We contacted Apple about the iOS 15 issues. What we were told, is that starting from iOS 15 the lifecycle methods do not necessarily need to be called in the order expected from previous iOS version. We found out, that |
May be related to https://developer.apple.com/forums/thread/693623 |
@bb-git thank you for information. Can you confirm you were able to fix that? @PetrBodnar thank you. It seems Apple have a fix for better crash reports on EXC_CRASH (SIGKILL). Maybe anyone can share fresh crashlogs? @romanrudyy does anything from above helps you to fix the issue? |
Hi @pavel-ship-it , I'm working on the same codebase / issue as @romanrudyy was working on in October. I found this thread and I believe this to be our issue: we are storing our Realm db in a shared container and accessing it from the app and from a notification extension: https://githubhot.com/repo/realm/realm-swift/issues/7649 Can you speak to what we can do about iOS 15 killing our app because of Realm access in the shared container while in the background? It sounds to me as though if we prevent all Realm access when the app becomes suspended, then Realm access via the notification extension shouldn't cause crashes (because there will be no file lock). Does that sound right to you? This is quite an undertaking to fix on my side so I'd love any insight you have - I see you commented in that other thread as well :) |
I've understood and solved the issue for our app: TL;DR: requesting a Explanation: I was able to repro the crash behaviour with a simple prototype app, requesting a We solved this issue with the following
It can then be used as follows: the background task lasts until the
Important note: if you don't wrap up your Realm activity before the background task expiration handler is called (~30 seconds after backgrounding), you'll crash, for the same reason as before. This gives you time to wrap up what you are doing, but doesn't fix that you can't hold a file lock when the app is suspended. |
Looks like this has been resolved. If anyone see this issue again, please create another issue referencing this one. Thanks! |
How frequently does the bug occur?
Sometimes
Description
We're having a ton of crash reports appearing after iOS 15 release that have not been present before. All of them are SIGKILL crashes and stack traces have nothing nut realm activity. Is this something that is a known issue?
Stacktrace & log output
Can you reproduce the bug?
Yes, sometimes
Reproduction Steps
The iOS will kill the app eventually
Version
10.7.6
What SDK flavour are you using?
Local Database only
Are you using encryption?
Yes, using encryption
Platform OS and version(s)
iOS 15
Build environment
Xcode version: ...
Dependency manager and version: ...
The text was updated successfully, but these errors were encountered: