-
Notifications
You must be signed in to change notification settings - Fork 65
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
SQLCompileStatement crash DEMO #38
base: master
Are you sure you want to change the base?
SQLCompileStatement crash DEMO #38
Conversation
Thank you for this, we will review and provide feedback on this. |
Hi @developernotes |
No, unfortunately I have not had an opportunity to review the test, however I hope to circle back to it later this week. I will provide an update once I've reviewed the scenario. Thanks! |
Are you only seeing this issue on Android 7/7.1, or elsewhere? I have been unable so far to restore a 7.1 image to a Pixel XL device for testing (i.e., OEM unlocking is disabled in developer settings). I did run this test 10 times on a Pixel 4 running Android 11, however, it does not fail there. If you could provide any information about the devices and OS's you are experiencing this on that would be helpful. |
Hi @developernotes, |
Hi @developernotes |
I have tried running this test repeatedly on an emulator using API 24, it is always successful for me. What ABI are you using for an emulator? |
Hi @developernotes
|
And on another image(x86_64) it also crashes, can't start armeabi emulator for some reason
|
I am also able to replicate the test crash.
|
Puzzling, my emulator details appear to mirror your almost identically (I've only removed the extraneous newlines below).
|
I was unable to checkout @oleksandr-semenov's branch so instead i just cloned this repo and copied / pasted the two file changes from this pull request. I then made a new emulator with API 24. Then clicked "Run Behavior Test Suite" in the app after it built with that one new file ( Those are all the steps I took to replicate. EDIT: When i cloned the project, it was requiring |
FYI here is how I checked out the @oleksandr-semenov branch:
When I run the app from Android Studio, it crashes consistently on both emulator and my Android 7.0 device (Samsung Galaxy S6 for Verizon 4G). I made my emulator is a Pixel 2 x86 emulator with API 24, would be happy to provide more details or trying on another emulator build if needed. Here is some trace output from my Android 7.0 (API 24) emulator: 2021-04-06 14:39:26.638 2608-2623/net.zetetic.sqlcipher.test W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2021-04-06 14:39:26.638 2608-2623/net.zetetic.sqlcipher.test D/OpenGLRenderer: Swap behavior 0
2021-04-06 14:39:26.758 2608-2623/net.zetetic.sqlcipher.test D/EGL_emulation: eglCreateContext: 0xa8685120: maj 3 min 0 rcv 3
2021-04-06 14:39:26.762 2608-2623/net.zetetic.sqlcipher.test D/EGL_emulation: eglMakeCurrent: 0xa8685120: ver 3 0 (tinfo 0xa86834d0)
2021-04-06 14:39:26.764 2608-2623/net.zetetic.sqlcipher.test E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
2021-04-06 14:39:26.764 2608-2623/net.zetetic.sqlcipher.test E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
2021-04-06 14:39:26.786 2608-2623/net.zetetic.sqlcipher.test D/EGL_emulation: eglMakeCurrent: 0xa8685120: ver 3 0 (tinfo 0xa86834d0)
2021-04-06 14:39:30.336 2608-2608/net.zetetic.sqlcipher.test I/Choreographer: Skipped 237 frames! The application may be doing too much work on its main thread.
2021-04-06 14:39:52.082 2608-2608/net.zetetic.sqlcipher.test I/TestSuiteBehaviorsActivity: onCreate
2021-04-06 14:39:52.448 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Running test suite on x86 platform
2021-04-06 14:39:52.561 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Running test:Finalize SQLComileStatement causes crash on API 24-25
2021-04-06 14:39:52.561 2608-2636/net.zetetic.sqlcipher.test I/SQLCompileStatementFinalizeTest: Before prepareDatabaseEnvironment
2021-04-06 14:39:52.561 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered prepareDatabaseEnvironment
2021-04-06 14:39:52.562 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before getDatabasePath
2021-04-06 14:39:52.563 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before mkdirs on parent of database path
2021-04-06 14:39:52.563 2608-2636/net.zetetic.sqlcipher.test I/SQLCompileStatementFinalizeTest: Before getDatabasePath
2021-04-06 14:39:52.564 2608-2636/net.zetetic.sqlcipher.test I/SQLCompileStatementFinalizeTest: Before createDatabase
2021-04-06 14:39:52.564 2608-2636/net.zetetic.sqlcipher.test I/SQLCompileStatementFinalizeTest: Before ZeteticApplication.getInstance().createDatabase
2021-04-06 14:39:52.564 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered ZeteticApplication::createDatabase
2021-04-06 14:39:52.564 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before SQLiteDatabase.openOrCreateDatabase
2021-04-06 14:39:55.634 2608-2608/net.zetetic.sqlcipher.test I/Choreographer: Skipped 215 frames! The application may be doing too much work on its main thread.
2021-04-06 14:39:56.837 2608-2608/net.zetetic.sqlcipher.test I/Choreographer: Skipped 70 frames! The application may be doing too much work on its main thread.
2021-04-06 14:39:57.010 2608-2623/net.zetetic.sqlcipher.test D/EGL_emulation: eglMakeCurrent: 0xa8685120: ver 3 0 (tinfo 0xa86834d0)
2021-04-06 14:39:58.062 2608-2636/net.zetetic.sqlcipher.test I/SQLCompileStatementFinalizeTest: Before setUp
2021-04-06 14:40:10.274 2608-2619/net.zetetic.sqlcipher.test I/art: Background sticky concurrent mark sweep GC freed 404740(3MB) AllocSpace objects, 1(64KB) LOS objects, 44% free, 4MB/8MB, paused 273us total 211.253ms
2021-04-06 14:40:30.796 2608-2614/net.zetetic.sqlcipher.test I/art: Thread[3,tid=2614,WaitingInMainSignalCatcherLoop,Thread*=0xa5e70e00,peer=0x12c2e790,"Signal Catcher"]: reacting to signal 3
2021-04-06 14:40:30.933 2608-2614/net.zetetic.sqlcipher.test I/art: Wrote stack traces to '/data/anr/traces.txt'
--------- beginning of crash
2021-04-06 14:40:35.823 2608-2618/net.zetetic.sqlcipher.test E/AndroidRuntime: FATAL EXCEPTION: FinalizerWatchdogDaemon
Process: net.zetetic.sqlcipher.test, PID: 2608
java.util.concurrent.TimeoutException: net.sqlcipher.database.SQLiteCompiledSql.finalize() timed out after 10 seconds
at java.lang.Object.wait(Native Method)
at java.lang.Thread.parkFor$(Thread.java:2127)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:161)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:840)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:873)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:200)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:262)
at net.sqlcipher.database.SQLiteDatabase.lock(SQLiteDatabase.java:570)
at net.sqlcipher.database.SQLiteCompiledSql.releaseSqlStatement(SQLiteCompiledSql.java:104)
at net.sqlcipher.database.SQLiteCompiledSql.finalize(SQLiteCompiledSql.java:146)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:222)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:209)
at java.lang.Thread.run(Thread.java:761)
2021-04-06 14:40:36.446 2608-2623/net.zetetic.sqlcipher.test D/EGL_emulation: eglMakeCurrent: 0xa8685120: ver 3 0 (tinfo 0xa86834d0)
2021-04-06 14:40:48.468 2608-2636/net.zetetic.sqlcipher.test I/SQLCompileStatementFinalizeTest: Test complete: Finalize SQLComileStatement causes crash on API 24-25 ran in 50.40 seconds using library version 4.4.2
2021-04-06 14:40:48.497 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Running test:SummingStepTest Test
2021-04-06 14:40:48.501 2608-2636/net.zetetic.sqlcipher.test I/SummingStepTest: Before prepareDatabaseEnvironment
2021-04-06 14:40:48.502 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered prepareDatabaseEnvironment
2021-04-06 14:40:48.502 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before getDatabasePath
2021-04-06 14:40:48.502 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before mkdirs on parent of database path
2021-04-06 14:40:48.502 2608-2608/net.zetetic.sqlcipher.test I/TestSuiteBehaviorsActivity: Finalize SQLComileStatement causes crash on API 24-25 - success:true
2021-04-06 14:40:48.502 2608-2636/net.zetetic.sqlcipher.test I/SummingStepTest: Before getDatabasePath
2021-04-06 14:40:48.502 2608-2636/net.zetetic.sqlcipher.test I/SummingStepTest: Before createDatabase
2021-04-06 14:40:48.502 2608-2636/net.zetetic.sqlcipher.test I/SummingStepTest: Before ZeteticApplication.getInstance().createDatabase
2021-04-06 14:40:48.502 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered ZeteticApplication::createDatabase
2021-04-06 14:40:48.502 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before SQLiteDatabase.openOrCreateDatabase
2021-04-06 14:40:48.866 2608-2636/net.zetetic.sqlcipher.test I/SummingStepTest: Before setUp
2021-04-06 14:40:50.965 2608-2636/net.zetetic.sqlcipher.test I/SummingStepTest: Test complete: SummingStepTest Test ran in 2.10 seconds using library version 4.4.2
2021-04-06 14:40:50.966 2608-2608/net.zetetic.sqlcipher.test I/TestSuiteBehaviorsActivity: SummingStepTest Test - success:true
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Running test:JSON cast test
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/JsonCastTest: Before prepareDatabaseEnvironment
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered prepareDatabaseEnvironment
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before getDatabasePath
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before mkdirs on parent of database path
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/JsonCastTest: Before getDatabasePath
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/JsonCastTest: Before createDatabase
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/JsonCastTest: Before ZeteticApplication.getInstance().createDatabase
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered ZeteticApplication::createDatabase
2021-04-06 14:40:50.968 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before SQLiteDatabase.openOrCreateDatabase
2021-04-06 14:40:51.020 2608-2636/net.zetetic.sqlcipher.test I/JsonCastTest: Before setUp
2021-04-06 14:40:51.022 2608-2636/net.zetetic.sqlcipher.test I/JsonCastTest: Test complete: JSON cast test ran in 0.00 seconds using library version 4.4.2
2021-04-06 14:40:51.023 2608-2608/net.zetetic.sqlcipher.test I/TestSuiteBehaviorsActivity: JSON cast test - success:true
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Running test:Simple Query Test
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/SimpleQueryTest: Before prepareDatabaseEnvironment
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered prepareDatabaseEnvironment
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before getDatabasePath
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before mkdirs on parent of database path
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/SimpleQueryTest: Before getDatabasePath
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/SimpleQueryTest: Before createDatabase
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/SimpleQueryTest: Before ZeteticApplication.getInstance().createDatabase
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered ZeteticApplication::createDatabase
2021-04-06 14:40:51.023 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before SQLiteDatabase.openOrCreateDatabase
2021-04-06 14:40:51.073 2608-2636/net.zetetic.sqlcipher.test I/SimpleQueryTest: Before setUp
2021-04-06 14:40:52.025 2608-2636/net.zetetic.sqlcipher.test I/SimpleQueryTest: Test complete: Simple Query Test ran in 0.95 seconds using library version 4.4.2
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Running test:null
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/DefaultCursorWindowAllocationTest: Before prepareDatabaseEnvironment
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered prepareDatabaseEnvironment
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before getDatabasePath
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before mkdirs on parent of database path
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/DefaultCursorWindowAllocationTest: Before getDatabasePath
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/DefaultCursorWindowAllocationTest: Before createDatabase
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/DefaultCursorWindowAllocationTest: Before ZeteticApplication.getInstance().createDatabase
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Entered ZeteticApplication::createDatabase
2021-04-06 14:40:52.026 2608-2636/net.zetetic.sqlcipher.test I/Zetetic: Before SQLiteDatabase.openOrCreateDatabase
2021-04-06 14:40:52.026 2608-2608/net.zetetic.sqlcipher.test I/TestSuiteBehaviorsActivity: Simple Query Test - success:true
2021-04-06 14:40:52.088 2608-2636/net.zetetic.sqlcipher.test I/DefaultCursorWindowAllocationTest: Before setUp
2021-04-06 14:40:52.092 2608-2636/net.zetetic.sqlcipher.test I/DefaultCursorWindowAllocationTest: Building database with 10,000 rows, 1 columns
2021-04-06 14:40:52.095 2608-2636/net.zetetic.sqlcipher.test I/DefaultCursorWindowAllocationTest: Generated column name:a for index:0
2021-04-06 14:42:04.483 2608-2619/net.zetetic.sqlcipher.test I/art: Background partial concurrent mark sweep GC freed 767(21KB) AllocSpace objects, 154(3MB) LOS objects, 39% free, 4MB/7MB, paused 112us total 124.443ms
2021-04-06 14:42:26.498 2608-2619/net.zetetic.sqlcipher.test I/art: Background partial concurrent mark sweep GC freed 762(21KB) AllocSpace objects, 153(2MB) LOS objects, 40% free, 4MB/7MB, paused 112us total 498.071ms I do find it very interesting that there is some trace output after the point of the crash. When I ran it on my Samsung Galaxy S6 with Android 7.0, it crashed but then I saw from logcat that the test suite actually ran and finished with 119 passed and 0 failed tests. We should be able to use BrowserStack (browserstack.com) to run on some Android 7 devices, they seem to offer free plans for open source projects. |
I also can reproduce the crash from the test of @oleksandr-semenov and not only with API 25 (Nexus 5) emulator in Android Studio, but also with Android 10 API 29 (Pixel 3) emulator: java.util.concurrent.TimeoutException: net.sqlcipher.database.SQLiteCompiledSql.finalize() timed out after 10 seconds |
@developernotes
1st test has locking set to false and, as expected, works fine. Try also looking in the log output. You should see this crash:
I don't know how to make it not crash on API <=25 I also use Android Studio to build the project and launch it. Maybe you could try doing this also? |
Hello @oleksandr-semenov Thank you for your follow-up. Internally we have been doing some work on SQLCipher for Android to extend disabling of the locking with the library and have been evaluating your test scenario in that context. When locking is enabled, your test creates a scenario where the Can you tell us a bit more about the threading environment within your application, and how those threads interface with SQLCipher for Android for both read and write operations? |
Thanks for continue looking into this issue. I found one new thing. A single test run on API >=26 didn't crash before. However, when I do a sequence of tests with locking set to false and true, it crashes any OS. This means that it can create problems for any OS, as @alla2040 reported previously. It's definitely a multithreading problem. My thoughts on the crash reason are that:
Our app does a lot of concurrent DB calls, and most of them are transactional. Even though transactions could be relatively quick, there might be many of them queued already, which will sum up to more than 10s of blocking time. This issue doesn't reproduce when we use Room/SQLite without encryption. My test replicates the case, and you can treat it as a set of stages:
Let me know if I can help more. |
I have just pushed up a change to the |
Thank you for your fixing the issue. |
Hi @shiita0903, This will be officially bundled with the next public SQLCipher core release. While we do not have a specific release date available, should you need it now, you are welcome to build the library from source based on the master branch and use it now. |
Hi, any update on when this would br released? This is impacting our app. |
Hi @himanshubakshi, No, we do not have a planned release date for the next version of SQLCipher yet. You may always consider the suggestions here to build from source to utilize a newer build. |
Is this still active bug ? |
1 similar comment
Is this still active bug ? |
Hello @cristiancardosodexcom, Not that I am aware of, it would be best for @oleksandr-semenov to comment. Please note the |
Added test to showcase crash on Android API 24-25 caused by
java.util.concurrent.TimeoutException: net.sqlcipher.database.SQLiteCompiledSql.finalize() timed out after 10 seconds
Run the test and wait ~30 seconds.
Warning:
This test will crash the app.
I don't see a clean way of integrating this as an Action in the app. Instead, I suggest doing an Instrumented Android test
Original issue:
sqlcipher/android-database-sqlcipher#537
This test repeats Room behavior when it generates code for delete method: