element-hq / element-hq/element-ios
Crash : cannot create crypto
- Dominant language
- Swift
- Stars
- 1.8k
- Forks
- 544
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
Working on Tchap iOS Dev team.
Element 1.11.2 merged.
Sometimes, when running the app from Xcode directly on my device, I got this crash :
```
2023-10-12 10:27:26.923147+0200 Tchap[66397:6579610] [MXCryptoV2Factory] deprecateLegacyStoreIfNecessary(credentials:updateProgress:): Legacy crypto store does not exist
2023-10-12 10:27:27.150657+0200 Tchap[66397:6579358] [MXCryptoSDK] Starting logs
2023-10-12 10:27:27.160960+0200 Tchap[66397:6579358] [MXCryptoMachine] createMachine(userId:deviceId:log:): Opening crypto store at /private/var/mobile/Containers/Shared/AppGroup/E1CE41B9-DB85-496D-B85E-706B787AF3DA/MXCryptoStore/@/matrix-sdk-crypto.sqlite3
2023-10-12 10:27:27.166001+0200 Tchap[66397:6579358] [MXCryptoSDK] DEBUG matrix_sdk_crypto_ffi::machine: new
2023-10-12 10:27:27.183901+0200 Tchap[66397:6579358] [MXCryptoSDK] DEBUG matrix_sdk_sqlite::crypto_store: Upgrading database version=4 new_version=8
2023-10-12 10:27:27.195206+0200 Tchap[66397:6579624] 🚨 [MXCryptoV2Factory] buildCrypto(session:migrationProgress:success:failure:): Cannot create crypto OpenStore(message: "Failed to open the store")
MatrixSDK/MXLog.swift:251: Fatal error: Cannot create crypto
2023-10-12 10:27:27.196813+0200 Tchap[66397:6579624] MatrixSDK/MXLog.swift:251: Fatal error: Cannot create crypto
```
It doesn't happen on Simulator. There's no DB upgrade in the log on simulator.
On my device, I install over an old version. That's why the database upgrade is fired I think.
But I suspect the DB upgrade could be the source of the problem.
### Outcome
#### What did you expect?
The app to launch.
#### What happened instead?
The app crash in DEV mode (normal) because of an assert about "Cannot create crypto"
### Your phone model
iPhone 12 mini
### Operating system version
16.6.1
### Application version
Element 1.11.2
### Homeserver
_No response_
### Will you send logs?
No
Contributor guide
Assessment
This issue has not been assessed yet.