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

Notifications: Crash in background activity -> File Locks #1979

Closed
Simon-Laux opened this issue Nov 15, 2023 · 1 comment
Closed

Notifications: Crash in background activity -> File Locks #1979

Simon-Laux opened this issue Nov 15, 2023 · 1 comment

Comments

@Simon-Laux
Copy link
Member

Simon-Laux commented Nov 15, 2023

As already mentioned in deltachat/deltachat-core-rust#4420 (comment), many of our background crashes are because of the file locks we hold, so we need to shutdown the database and account manager additionally to stopIo to remove the locks and fully prepare the app for suspense without being killed by the system for still holding locks.

Specifically accounts/accounts.lock and accounts/23cc2440fa7e45599169db4cd0a2a121/dc.db so iOS app needs to close both the database and the whole account manager to release accounts.lock.

I think this affects both encrypted accounts (sqlcipher) and the new lock file created but the account manager.
Why do I think it's only for encrypted accounts? because I only have one encrypted account on the test device, while having around 4 unencrypted accounts, I assume there must be more locks otherwise (unless this is about account selection, but @link2xt told me that sqlcipher is known for creating locks).

What points to this issue:
The log that I pulled from the iPhone and viewed on the Console Mac app:

standard	08:29:32.448158+0100	runningboardd	[application<chat.delta>:6570] Set darwin role to: None
standard	08:29:32.448230+0100	runningboardd	[application<chat.delta>:6570] set Memory Limits to Hard Inactive (2098)
standard	08:29:32.448348+0100	runningboardd	[application<chat.delta>:6570] check if suspended process is holding locks
standard	08:29:32.460998+0100	runningboardd	[application<chat.delta>:6570] Found locked file lock: /var/mobile/Containers/Shared/AppGroup/BEA5D4F2-D7ED-422A-88CF-7D471FAB8CAE/accounts/accounts.lock
standard	08:29:32.465152+0100	runningboardd	[application<chat.delta>:6570] Found locked file lock: /var/mobile/Containers/Shared/AppGroup/BEA5D4F2-D7ED-422A-88CF-7D471FAB8CAE/accounts/23cc2440fa7e45599169db4cd0a2a121/dc.db
fehler	08:29:32.465698+0100	runningboardd	[application<chat.delta>:6570] suspended with locked system files:
/var/mobile/Containers/Shared/AppGroup/BEA5D4F2-D7ED-422A-88CF-7D471FAB8CAE/accounts/accounts.lock
/var/mobile/Containers/Shared/AppGroup/BEA5D4F2-D7ED-422A-88CF-7D471FAB8CAE/accounts/23cc2440fa7e45599169db4cd0a2a121/dc.db
fehler	08:29:32.465761+0100	runningboardd	[application<chat.delta>:6570] locked files not in allowed directories: /var/mobile/Containers/Data/Application/0B8944B3-B7FF-417C-AAE2-0F63C7DD42E7
/var/mobile/Containers/Data/Application/0B8944B3-B7FF-417C-AAE2-0F63C7DD42E7/tmp
standard	08:29:32.465934+0100	runningboardd	[application<chat.delta>:6570] Terminating with context: <RBSTerminateContext| domain:15 code:0xDEAD10CC explanation:[application<chat.delta>:6570] was suspended with locked system files:
/var/mobile/Containers/Shared/AppGroup/BEA5D4F2-D7ED-422A-88CF-7D471FAB8CAE/accounts/accounts.lock
/var/mobile/Containers/Shared/AppGroup/BEA5D4F2-D7ED-422A-88CF-7D471FAB8CAE/accounts/23cc2440fa7e45599169db4cd0a2a121/dc.db
not in allowed directories:
/var/mobile/Containers/Data/Application/0B8944B3-B7FF-417C-AAE2-0F63C7DD42E7
/var/mobile/Containers/Data/Application/0B8944B3-B7FF-417C-AAE2-0F63C7DD42E7/tmp reportType:CrashLog maxTerminationResistance:Absolute>
standard	08:29:32.465976+0100	runningboardd	[application<chat.delta>:6570] terminate_with_reason() success
standard	08:29:32.466099+0100	kernel	deltachat-ios[6570] Corpse allowed 1 of 5

BTW if we should use the unified logging system (os_log, in #1973) our log messages would also be readable with the console Mac app.

The other indicator for this is the crash statistics we got from apple:
Bildschirmfoto 2023-11-15 um 03 11 09
as you can see it is about file locks.

related to: #1202

@r10s
Copy link
Member

r10s commented Dec 6, 2023

concrete actionable items to target this issue in #2009 and #2010

@r10s r10s closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants