yigit / android-priority-jobqueue

A Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (Sqlite code 14), (OS error - 24:Too many open files)

BigBrother2018 opened this issue · comments

android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (Sqlite code 14), (OS error - 24:Too many open files)
at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:591)
at android.database.sqlite.SQLiteSession.execute(SQLiteSession.java:634)
at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:44)
at com.birbit.android.jobqueue.persistentQueue.sqlite.SqliteJobQueue.setSessionIdOnJob(SqliteJobQueue.java:360)
at com.birbit.android.jobqueue.persistentQueue.sqlite.SqliteJobQueue.nextJobAndIncRunCount(SqliteJobQueue.java:301)
at com.birbit.android.jobqueue.cachedQueue.CachedJobQueue.nextJobAndIncRunCount(CachedJobQueue.java:79)
at com.birbit.android.jobqueue.JobManagerThread.getNextJob(JobManagerThread.java:665)
at com.birbit.android.jobqueue.JobManagerThread.getNextJob(JobManagerThread.java:642)
at com.birbit.android.jobqueue.ConsumerManager.handleIdle(ConsumerManager.java:199)
at com.birbit.android.jobqueue.JobManagerThread$1.handleMessage(JobManagerThread.java:231)
at com.birbit.android.jobqueue.messaging.PriorityMessageQueue.consume(PriorityMessageQueue.java:39)
at com.birbit.android.jobqueue.JobManagerThread.run(JobManagerThread.java:222)
at java.lang.Thread.run(Thread.java:784)

//same problem here, i am not sure if it is because too many consumers, for my case the max consumers
// is 10.

Log:
08-28 23:27:09.997 9104 9859 E SQLiteLog: (14) cannot open file at line 29011 of [2ef4f3a5b1]
08-28 23:27:09.997 9104 9859 E SQLiteLog: (14) os_unix.c:29011: (24) open(/data/user/0/XXXXXXX/databases) -
08-28 23:27:10.012 9104 10684 I art : Alloc partial concurrent mark sweep GC freed 152(13KB) AllocSpace objects, 0(0B) LOS objects, 33% free, 31MB/47MB, paused 1.452ms total 28.862ms
08-28 23:27:10.012 9104 22166 I art : WaitForGcToComplete blocked for 29.071ms for cause Alloc
08-28 23:27:10.012 9104 22166 I art : Starting a blocking GC Alloc
08-28 23:27:10.048 9104 22166 I art : Alloc concurrent mark sweep GC freed 18(1808B) AllocSpace objects, 0(0B) LOS objects, 20% free, 61MB/77MB, paused 1.553ms total 36.233ms
08-28 23:27:10.118 9104 9859 E SQLiteLog: (14) cannot open file at line 31278 of [2ef4f3a5b1]
08-28 23:27:10.118 9104 9859 E SQLiteLog: (14) os_unix.c:31278: (24) open(/data/user/0/XXXXXXXXXX/databases/db_default_job_manager-journal) -
08-28 23:27:10.118 9104 9859 E SQLiteLog: (14) cannot open file at line 31278 of [2ef4f3a5b1]
08-28 23:27:10.118 9104 9859 E SQLiteLog: (14) os_unix.c:31278: (24) open(/data/user/0/XXXXXXXXXX/databases/db_default_job_manager-journal) -
08-28 23:27:10.118 9104 9859 E SQLiteLog: (14) statement aborts at 10: [SELECT tag_name FROM job_holder_tags WHERE job_id = ?] unable to open database file

maxConsumerCount(3)//up to 3 consumers at a time

maxConsumerCount(3)//up to 3 consumers at a time
My problem has been Solved. I think the consumer number doesn't matter. In my case, it's other part of the code that opens too many files, but the application process has a limitation for opening files. I use a shell command to identify my problem. Using the following command can list all the opening file of your process.

    lsof | grep 11418(Pid)

then I found many socket related files opening,
I continue using

    lsof | grep 11418 | grep socket | wc -l

to keep track of the number of specific type of files and found it increases gradually, and the murder reveals!