1

我使用带有 Dagger 的 SqlBrite 并在最小化应用程序并尝试查询项目后出现该错误。

我在每个查询中都有该查询:

try {....} finally {  cursor.close();}

我尝试在 onPause() 中关闭数据库,但我没有帮助。

只有在最小化应用程序后才能重现错误。

/placeholder I/art: Background partial concurrent mark sweep GC freed 264415(10MB) AllocSpace objects, 0(0B) LOS objects, 16% free, 80MB/96MB, paused 39.204ms total 643.281ms
    04-10 16:12:24.137 24515-24521/placeholder I/art: Disabling alloc tracker
    04-10 16:12:25.930 24515-24521/placeholder W/art: Suspending all threads took: 163.733ms
    04-10 16:12:25.956 24515-24525/placeholder W/art: Suspending all threads took: 26.034ms
    04-10 16:12:26.133 24515-25799/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.133 24515-25456/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.133 24515-26034/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.134 24515-28025/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.134 24515-28024/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.136 24515-26028/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.136 24515-28029/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.136 24515-28027/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.136 24515-28026/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.137 24515-28030/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.137 24515-26026/placeholder E/SQLiteLog: (14) cannot open file at line 31278 of [2ef4f3a5b1]
    04-10 16:12:26.137 24515-26026/placeholder E/SQLiteLog: (14) os_unix.c:31278: (24) open(/data/user/0/placeholder/databases/todo.db-journal) - 
    04-10 16:12:26.137 24515-26026/placeholder E/SQLiteLog: (14) cannot open file at line 31278 of [2ef4f3a5b1]
    04-10 16:12:26.137 24515-26026/placeholder E/SQLiteLog: (14) os_unix.c:31278: (24) open(/data/user/0/placeholder/databases/todo.db-journal) - 
    04-10 16:12:26.137 24515-26026/placeholder E/SQLiteLog: (14) statement aborts at 20: [SELECT * FROM placeholder WHERE placeholder = ?] unable to open database file
    04-10 16:12:26.138 24515-26026/placeholder E/SQLiteQuery: exception: unable to open database file (code 14); query: SELECT * FROM placeholder WHERE placeholder = ?
    04-10 16:12:26.139 24515-24515/placeholder E/art: ashmem_create_region failed for 'indirect ref table': Too many open files
    04-10 16:12:26.140 24515-24515/placeholder W/art: Throwing OutOfMemoryError "Could not allocate JNI Env"
    04-10 16:12:26.140 24515-28031/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.140 24515-25545/placeholder E/CursorWindow: Could not allocate CursorWindow '/data/user/0/placeholder/databases/todo.db' of size 2097152 due to error -24.
    04-10 16:12:26.140 24515-25819/placeholder E/SQLiteLog: (14) cannot open file at line 31278 of [2ef4f3a5b1]
    04-10 16:12:26.141 24515-25819/placeholder E/SQLiteLog: (14) os_unix.c:31278: (24) open(/data/user/0/placeholder/databases/todo.db-journal) - 
    04-10 16:12:26.141 24515-25819/placeholder E/SQLiteLog: (14) cannot open file at line 31278 of [2ef4f3a5b1]
    04-10 16:12:26.141 24515-25819/placeholder E/SQLiteLog: (14) os_unix.c:31278: (24) open(/data/user/0/placeholder/databases/todo.db-journal) - 
    04-10 16:12:26.141 24515-25819/placeholder E/SQLiteLog: (14) statement aborts at 20: [SELECT * FROM placeholder WHERE placeholder = ?] unable to open database file
    04-10 16:12:26.141 24515-25819/placeholder E/SQLiteQuery: exception: unable to open database file (code 14); query: SELECT * FROM placeholder WHERE placeholder = ?
    04-10 16:12:26.143 24515-24515/placeholder W/System.err: java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.
    04-10 16:12:26.143 24515-24515/placeholder W/System.err:     at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:111)
    04-10 16:12:26.144 24515-24515/placeholder W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
    04-10 16:12:26.144 24515-24515/placeholder W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
    04-10 16:12:26.144 24515-24515/placeholder W/System.err:     at android.os.Looper.loop(Looper.java:148)
    04-10 16:12:26.145 24515-24515/placeholder W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5441)
    04-10 16:12:26.146 24515-24515/placeholder W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
    04-10 16:12:26.146 24515-24515/placeholder W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
4

0 回答 0