Skip to content
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

SQLITE_CANTOPEN_EMFILE #159

Open
creati8e opened this issue Mar 6, 2018 · 2 comments
Open

SQLITE_CANTOPEN_EMFILE #159

creati8e opened this issue Mar 6, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@creati8e
Copy link

creati8e commented Mar 6, 2018

Hi guys! I've got an app crash after multiple app switches from recents screen.
I initialize Amplitude once in onCreate method of Application class.
Here is the stacktrace:

E/SQLiteLog: (28) failed to open "/data/data/hk.moneon.debug/databases/com.amplitude.api-journal" with flag (131072) and mode_t (1b0) due to error (24)
E/SQLiteLog: (14) cannot open file at line 32557 of [b3bb660af9]
E/SQLiteLog: (14) os_unix.c:32557: (24) open(/data/data/hk.moneon.debug/databases/com.amplitude.api-journal) -
E/SQLiteLog: (28) failed to open "/data/data/hk.moneon.debug/databases/com.amplitude.api-journal" with flag (131074) and mode_t (1b0) due to error (24)
E/SQLiteLog: (28) failed to open "/data/data/hk.moneon.debug/databases/com.amplitude.api-journal" with flag (131072) and mode_t (1b0) due to error (24)
E/SQLiteLog: (14) cannot open file at line 32557 of [b3bb660af9]
E/SQLiteLog: (14) os_unix.c:32557: (24) open(/data/data/hk.moneon.debug/databases/com.amplitude.api-journal) -
E/SQLiteLog: (2062) statement aborts at 1: [PRAGMA user_version;] unable to open database file
E/REALM: could not create WeakRealmNotifier ALooper message pipe: Too many open files.
E/REALM: uncaught exception in notifier thread: St12system_error: Bad file number
E/com.amplitude.api.DatabaseHelper: insertOrReplaceKeyValue in long_store failed
android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 2062)

Error Code : 2062 (SQLITE_CANTOPEN_EMFILE) Caused By : Application has opened two many files. Maximum of available file descriptors in one process is 1024 in default. (unable to open database file (code 2062)) #################################################################
at android.database.sqlite.SQLiteConnection.nativeExecuteForLong(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:768)
at android.database.sqlite.SQLiteSession.executeForLong(SQLiteSession.java:652)
at android.database.sqlite.SQLiteStatement.simpleQueryForLong(SQLiteStatement.java:107)
at android.database.DatabaseUtils.longForQuery(DatabaseUtils.java:825)
at android.database.DatabaseUtils.longForQuery(DatabaseUtils.java:813)
at android.database.sqlite.SQLiteDatabase.getVersion(SQLiteDatabase.java:1002)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:241)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
at com.amplitude.api.DatabaseHelper.insertOrReplaceKeyValueToTable(DatabaseHelper.java:147)
at com.amplitude.api.DatabaseHelper.insertOrReplaceKeyLongValue(DatabaseHelper.java:141)
at com.amplitude.api.AmplitudeClient.getNextSequenceNumber(AmplitudeClient.java:1000)
at com.amplitude.api.AmplitudeClient.logEvent(AmplitudeClient.java:902)
at com.amplitude.api.AmplitudeClient$5.run(AmplitudeClient.java:841)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)

@whalemare
Copy link

Also have this error
Reproduced when screen orientation changes and send logs

@haoliu-amp haoliu-amp added the bug Something isn't working label Mar 25, 2020
@qingzhuozhen
Copy link
Contributor

We now have a new Android Kotlin SDK now! Feel free to check it out and let us know if any feedback! That library is not using any SQLite so should get rid of this error then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants