wcdb icon indicating copy to clipboard operation
wcdb copied to clipboard

Android运行sample-encryptdb demo点击INIT ENCRYPTED DB发生crash

Open WinnieZy opened this issue 5 years ago • 4 comments

The language of WCDB

Java

The version of WCDB

v1.0.8

The platform of WCDB

Android

The installation of WCDB

Git clone

What's the issue?

执行sample-encryptdb后点击加密数据库发生crash 操作路径: 1.点击INIT PLAIN_TEXT DB 2.点击INIT ENCRYPTED DB 3.发生crash

当操作路径改为 1.点击INIT ENCRYPTED DB 2.点击INIT PLAIN_TEXT DB 则可正常操作,插入数据,正常运行无crash

具体crash报错位置: A/libc: E://wcdb/android/jni/com_tencent_wcdb_database_SQLiteConnection.cpp:1244: void wcdb::nativeSetUpdateNotification(JNIEnv *, jclass, jlong, jboolean, jboolean): assertion "!conn->notifyCommited" failed Fatal signal 6 (SIGABRT), code -6 in tid 25598 (AsyncTask #2) image

具体报错堆栈:


Build fingerprint: 'Xiaomi/chiron/chiron:8.0.0/OPR1.170623.027/V10.2.2.0.ODECNXM:user/release-keys' Revision: '0' ABI: 'arm64' pid: 13912, tid: 13938, name: AsyncTask #2 >>> com.tencent.wcdb.sample.encryptdb <<< signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- Abort message: 'E:/wcdb/android/jni/com_tencent_wcdb_database_SQLiteConnection.cpp:1244: void wcdb::nativeSetUpdateNotification(JNIEnv *, jclass, jlong, jboolean, jboolean): assertion "!conn->notifyCommited" failed' x0 0000000000000000 x1 0000000000003672 x2 0000000000000006 x3 0000000000000008 x4 0080000000808080 x5 0080000000808080 x6 0080000000808080 x7 0000000000000010 x8 0000000000000083 x9 6f83cdea9c77e5d9 x10 0000000000000000 x11 0000000000000001 x12 ffffffffffffffff x13 0000000000000001 x14 002aea4da4611a00 x15 00008e579da9c174 x16 00000070951d92e8 x17 000000709517ad2c x18 00000070789f8f94 x19 0000000000003658 x20 0000000000003672 x21 00000070841a6000 x22 00000070789f954c x23 00000070892b8b15 x24 0000000000000010 x25 00000070841a6098 x26 0000000000000000 x27 0000000000000000 x28 00000070789f9290 x29 00000070789f9090 x30 000000709512ee54 sp 00000070789f9050 pc 000000709517ad34 pstate 0000000060000000

backtrace: #00 pc 0000000000069d34 /system/lib64/libc.so (tgkill+8) #01 pc 000000000001de50 /system/lib64/libc.so (abort+88) #02 pc 0000000000025644 /system/lib64/libc.so (__libc_fatal+116) #03 pc 000000000001e1e0 /system/lib64/libc.so (__assert2+48) #04 pc 000000000003bdcc /data/app/com.tencent.wcdb.sample.encryptdb-l3Ig4BDXAWldcgt-ZvlXaw==/lib/arm64/libwcdb.so #05 pc 0000000000517700 /system/lib64/libart.so (art_quick_generic_jni_trampoline+144) #06 pc 000000000050e638 /system/lib64/libart.so (art_quick_invoke_static_stub+600) #07 pc 00000000000d8e80 /system/lib64/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+260) #08 pc 0000000000283490 /system/lib64/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+352) #09 pc 000000000027db60 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+672) #10 pc 00000000004f7218 /system/lib64/libart.so (MterpInvokeStatic+468) #11 pc 00000000004fff94 /system/lib64/libart.so (ExecuteMterpImpl+14612) #12 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #13 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #14 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #15 pc 00000000004f6f60 /system/lib64/libart.so (MterpInvokeDirect+504) #16 pc 00000000004fff14 /system/lib64/libart.so (ExecuteMterpImpl+14484) #17 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #18 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #19 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #20 pc 00000000004f5bf4 /system/lib64/libart.so (MterpInvokeVirtual+612) #21 pc 00000000004ffe14 /system/lib64/libart.so (ExecuteMterpImpl+14228) #22 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #23 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #24 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #25 pc 00000000004f6f60 /system/lib64/libart.so (MterpInvokeDirect+504) #26 pc 00000000004fff14 /system/lib64/libart.so (ExecuteMterpImpl+14484) #27 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #28 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #29 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #30 pc 00000000004f5bf4 /system/lib64/libart.so (MterpInvokeVirtual+612) #31 pc 00000000004ffe14 /system/lib64/libart.so (ExecuteMterpImpl+14228) #32 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #33 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #34 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #35 pc 00000000004f5bf4 /system/lib64/libart.so (MterpInvokeVirtual+612) #36 pc 00000000004ffe14 /system/lib64/libart.so (ExecuteMterpImpl+14228) #37 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #38 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #39 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #40 pc 00000000004f6f60 /system/lib64/libart.so (MterpInvokeDirect+504) #41 pc 00000000004fff14 /system/lib64/libart.so (ExecuteMterpImpl+14484) #42 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #43 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #44 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #45 pc 00000000004f5bf4 /system/lib64/libart.so (MterpInvokeVirtual+612) #46 pc 00000000004ffe14 /system/lib64/libart.so (ExecuteMterpImpl+14228) #47 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #48 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #49 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #50 pc 00000000004f5bf4 /system/lib64/libart.so (MterpInvokeVirtual+612) #51 pc 00000000004ffe14 /system/lib64/libart.so (ExecuteMterpImpl+14228) #52 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #53 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #54 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #55 pc 00000000004f6f60 /system/lib64/libart.so (MterpInvokeDirect+504) #56 pc 00000000004fff14 /system/lib64/libart.so (ExecuteMterpImpl+14484) #57 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #58 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212) #59 pc 000000000027db40 /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640) #60 pc 00000000004f6f60 /system/lib64/libart.so (MterpInvokeDirect+504) #61 pc 00000000004fff14 /system/lib64/libart.so (ExecuteMterpImpl+14484) #62 pc 000000000025e8dc /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444) #63 pc 0000000000264fdc /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)

WinnieZy avatar Apr 05 '19 10:04 WinnieZy

翻看了这篇 当我尝试加密数据库的时候遇到这个bug #21 里面的记录,通过设置setWriteAheadLoggingEnabled(false);问题得到解决; 求问这是什么原因导致设为true的时候会crash; 我这边两台手机(Android5.0和Android8.0)都是必现的; 迁移到加密数据库的时候必须要关闭WAL吗? 这个问题除了关闭WAL还有其它解决方法吗?

WinnieZy avatar Apr 05 '19 12:04 WinnieZy

@WinnieZy 请问是自己编译的吗?使用Maven AAR或者release aar有问题吗?

John-He-928 avatar Apr 11 '19 10:04 John-He-928

是自己编译的,试了一下maven aar的形式就不会crash

WinnieZy avatar Apr 11 '19 14:04 WinnieZy

遇到同样的问题。 1.自己编译最新的版本会报同样的错误 设置setWriteAheadLoggingEnabled(false)后正常 2.使用maven aar引入1.0.8正常

FlyMarco avatar Dec 07 '19 10:12 FlyMarco