SQLCipher for Android 3.5.6 performance and stability issues

We experienced a lot of performance and stability issues on some Android devices with the 3.5.6 release, partially resulting in native crashes. According to the description of the users in the developer console, these crashes happen, when the app is performing particularly heavy queries.

Downgrading to 3.5.4 fixed the problem.

Here’s a stack trace:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/occam/mako:5.1.1/LMY48M/2167285:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 12186, tid: 14729, name: Thread-639 >>> com.example.app <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x9cae34e8
r0 9c9e1f92 r1 00000000 r2 00000010 r3 9c9e2022
r4 9cae34e8 r5 00000090 r6 9c9e1f92 r7 00100f8a
r8 b928b4a8 r9 00000000 sl 00000001 fp 00000034
ip 00000000 sp 9e7be290 lr af03d9e1 pc af03d9e0 cpsr 40010030

backtrace:
#00 pc 000ad9e0 /data/app/com.example.app-2/lib/arm/libsqlcipher.so (sqlcipher::CursorWindow::allocRow()+57)
#01 pc 000ac76b /data/app/com.example.app-2/lib/arm/libsqlcipher.so
#02 pc 00e3b04f /data/app/com.example.app-2/oat/arm/base.odex (offset 0x838000)

Hello @mimiks

Thank you for your report. In the 3.5.5 release we included an adjustment to the CursorWindow allocation routine to allow the window to grow beyond the 1 MB limit. I would be curious if you are able to recreate a crash within the SQLCipher for Android test suite? We would be happy to look into this further. Thanks!

We have not been able to reproduce the crashes on our own test devices, however the developer console was full of them, spanning a wide range of devices from different manufacturers.

I will investigate further and let you know if the crash can be recreated with the test suite.

I was not able to reproduce the crash with the test suite. But then again, we didn’t notice the bug either on our test devices and the emulator before shipping the product and getting hundreds of identical native crashes in the dev console, so I’m not sure what actually triggers it. Some people also reported a general slowdown of the app with SQLCipher 3.5.6.

Please let me know if I can help with more information.

Hi @mimiks

Would it be possible to you to reach out to one of your users who is reporting the issue? Having a reproducible issue in the test suite allows us to narrow down the root cause. Are you currently using the community edition of the library, or do you hold a commercial license? Thanks!

I might be able to arrange that. Please contact me privately.
We’re using the community edition.

We also experienced a large number of these crashes in our latest release. It seems to effect devices in APAC regions specifically. It doesn’t impact any of our test devices in the US. We had to do an emergency hotfix to rollback to 3.5.3 (which we were using previously).