LitePal
LitePal copied to clipboard
android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file
2021-01-28 23:09:09.899 24542-19912/? E/SQLiteLog: (14) cannot open file at line 32456 of [bda77dda96] 2021-01-28 23:09:09.899 24542-19912/? E/SQLiteLog: (14) os_unix.c:32456: (24) open(/data/user/0/cn.xxxx.xxxx/databases/ConfirmFailureDb.db-journal) - 2021-01-28 23:09:09.901 24542-19912/? E/SQLiteLog: (14) cannot open file at line 32456 of [bda77dda96] 2021-01-28 23:09:09.902 24542-19912/? E/SQLiteLog: (14) os_unix.c:32456: (24) open(/data/user/0/cn.xxxx.xxxx/databases/ConfirmFailureDb.db-journal) - 2021-01-28 23:09:09.902 24542-19912/? E/SQLiteLog: (14) statement aborts at 1: [BEGIN EXCLUSIVE;] unable to open database file 2021-01-28 23:09:09.903 24542-19912/? W/System.err: android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 14) 2021-01-28 23:09:09.903 24542-19912/? W/System.err: at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method) 2021-01-28 23:09:09.904 24542-19912/? W/System.err: at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:555) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at android.database.sqlite.SQLiteSession.beginTransactionUnchecked(SQLiteSession.java:323) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at android.database.sqlite.SQLiteSession.beginTransaction(SQLiteSession.java:298) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:507) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:418) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at org.litepal.crud.LitePalSupport.saveThrows(LitePalSupport.java:411) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at org.litepal.crud.LitePalSupport.save(LitePalSupport.java:349) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at cn.xxxx.xxxx.service.ClientService.checkGateStatus(ClientService.java:437) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at cn.xxxx.xxxx.service.ClientService.lambda$heartBeat$2$ClientService(ClientService.java:524) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at cn.xxxx.xxxx.service.-$$Lambda$ClientService$RCIoeSQ2n15lYmDsG2eVmYNvm_0.run(lambda) 2021-01-28 23:09:09.906 24542-19912/? W/System.err: at java.lang.Thread.run(Thread.java:761)
主要发生在频繁操作数据库后2个小时左右,插入了1400+条数据。
并发量不高,可以断定秒级操作内就一个执行……
我也在项目中经常遇到, 但是我本人能力不够, 没啥好办法去处理这个东西, 好像是系统对数据库文件锁定了, 这时候再去操作数据库, 就会报错