plaidev / karte-android-sdk

KARTE SDK for Android
https://karte.io/
Apache License 2.0
5 stars 3 forks source link

[core] Application crashes when there is not enough free storage space on the device #5

Closed wasnot closed 3 years ago

wasnot commented 3 years ago

Expected Behavior

SDK works properly without a crash.

Current Behavior

Application will crash when launching.

Possible Solution

This issue has been fixed in core 2.6.1 https://developers.karte.io/docs/release-notes-android-sdk-v2#core-261

Steps to Reproduce

  1. Prepare a device with low free storage space
  2. Implement the SDK and launch the app

Context (Environment)

This problem occurs if you are using core 2.6.0 or lower.

Detailed Description

Crash Log - SQLiteFullException ``` io.karte.android.sample E/SQLiteDatabase: Error inserting visitor_id=d91b3b8b-9d58-432c-88f8-1a097accbe8d event={"event_name":"view","values":{"view_name":"basic_activity","title":"basic_activity","_local_event_date":1607212772},"_is_retryable":true} pv_id=32f52efc-d8fa-43f9-8571-98124c063fc1 retry=0 state=0 original_pv_id=b8049bd4-13f9-4349-bbcc-67e4805d873d android.database.sqlite.SQLiteFullException: database or disk is full (code 13 SQLITE_FULL) at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:938) at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790) at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88) at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1701) at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1570) at io.karte.android.utilities.datastore.DataStore$Companion.put(DataStore.kt:124) at io.karte.android.tracking.queue.Dispatcher$push$1.run(Dispatcher.kt:73) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) ``` - IOException ``` io.karte.android.sample E/AndroidRuntime: FATAL EXCEPTION: io.karte.android.logger.buffer Process: io.karte.android.sample, PID: 383 java.io.IOException: write failed: ENOSPC (No space left on device) at libcore.io.IoBridge.write(IoBridge.java:540) at java.io.FileOutputStream.write(FileOutputStream.java:398) at java.io.FileOutputStream.write(FileOutputStream.java:376) at io.karte.android.core.logger.FileAppender.write(FileAppender.kt:118) at io.karte.android.core.logger.FileAppender.access$write(FileAppender.kt:60) at io.karte.android.core.logger.FileAppender$append$1.run(FileAppender.kt:102) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: android.system.ErrnoException: write failed: ENOSPC (No space left on device) at libcore.io.Linux.writeBytes(Native Method) at libcore.io.Linux.write(Linux.java:293) at libcore.io.ForwardingOs.write(ForwardingOs.java:240) at libcore.io.BlockGuardOs.write(BlockGuardOs.java:418) at libcore.io.ForwardingOs.write(ForwardingOs.java:240) at libcore.io.IoBridge.write(IoBridge.java:535) at java.io.FileOutputStream.write(FileOutputStream.java:398)  at java.io.FileOutputStream.write(FileOutputStream.java:376)  at io.karte.android.core.logger.FileAppender.write(FileAppender.kt:118)  at io.karte.android.core.logger.FileAppender.access$write(FileAppender.kt:60)  at io.karte.android.core.logger.FileAppender$append$1.run(FileAppender.kt:102)  at android.os.Handler.handleCallback(Handler.java:938)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:223)  at android.os.HandlerThread.run(HandlerThread.java:67)  ```

Possible Implementation

wasnot commented 3 years ago

This crash was rarely reproduced even after core 2.6.1, and we released core 2.11.1 with additional fixes. plaidev/karte-android-sdk#8 https://developers.karte.io/docs/release-notes-android-sdk-v2#core-2111