My app downloads .mp3 files one by one with DownloadManager. Usually it works as expected. But sometimes download hangs and a progress bar stops updating inside the DownloadManager notification. If I click on the notification at the moment - my app crashes with SQLiteCantOpenDatabaseException:
04-19 17:18:11.167 4533-29108/android.process.media E/SQLiteLog: (14) cannot open file at line 30059 of [b3bb660af9]
04-19 17:18:11.177 4533-29108/android.process.media E/SQLiteLog: (14) os_unix.c:30059: (24) open(/data/data/com.android.providers.downloads/databases/downloads.db-journal) -
04-19 17:18:11.177 4533-29108/android.process.media E/SQLiteLog: (14) cannot open file at line 30059 of [b3bb660af9]
04-19 17:18:11.177 4533-29108/android.process.media E/SQLiteLog: (14) os_unix.c:30059: (24) open(/data/data/com.android.providers.downloads/databases/downloads.db-journal) -
04-19 17:18:11.177 4533-29108/android.process.media E/SQLiteLog: (14) statement aborts at 11: [SELECT _id, bypass_recommended_size_limit, uri FROM downloads WHERE (_id = ?)] unable to open database file
04-19 17:18:11.177 4533-29108/android.process.media E/SQLiteQuery: exception: unable to open database file (code 14); query: SELECT _id, bypass_recommended_size_limit, uri FROM downloads WHERE (_id = ?)
04-19 17:18:11.437 4533-4551/android.process.media E/SQLiteLog: (14) cannot open file at line 30059 of [b3bb660af9]
04-19 17:18:11.447 4533-4551/android.process.media E/SQLiteLog: (14) os_unix.c:30059: (24) open(/data/data/com.android.providers.downloads/databases/downloads.db-journal) -
04-19 17:18:11.447 4533-4551/android.process.media E/SQLiteLog: (14) cannot open file at line 30059 of [b3bb660af9]
04-19 17:18:11.447 4533-4551/android.process.media E/SQLiteLog: (14) os_unix.c:30059: (24) open(/data/data/com.android.providers.downloads/databases/downloads.db-journal) -
04-19 17:18:11.447 4533-4551/android.process.media E/SQLiteLog: (14) statement aborts at 49: [SELECT _id, _data AS local_filename, mediaprovider_uri, destination, title, description, uri, status, hint, mimetype AS media_type, total_bytes AS total_size, lastmod AS last_modified_
04-19 17:18:11.447 4533-4551/android.process.media E/SQLiteQuery: exception: unable to open database file (code 14); query: SELECT _id, _data AS local_filename, mediaprovider_uri, destination, title, description, uri, status, hint, mimetype AS media_type, total_bytes AS total_size, lastmod AS last_modified_timestamp, current_bytes AS bytes_so_far, allow_write, errorMsg, notificationpackage, 'placeholder' AS local_uri, 'placeholder' AS reason, entity, file_create_time, downloading_current_speed, download_surplus_time, xl_accelerate_speed, downloaded_time, xl_vip_status, xl_vip_cdn_url, xl_task_open_mark, download_task_thumbnail, apk_package_name, errorMsg, notificationpackage, download_file_hash, download_apk_install_way, download_extra, download_speedup_time, download_speedup_status, download_speedup_mode FROM downloads WHERE ((status='192') AND deleted != '1') ORDER BY _id DESC
04-19 17:18:11.457 4533-4551/android.process.media E/DatabaseUtils: Writing exception to parcel
android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 14)
at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(Native Method)
at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:845)
at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:836)
at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:146)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:135)
at android.database.CursorToBulkCursorAdaptor.getBulkCursorDescriptor(CursorToBulkCursorAdaptor.java:145)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:122)
at android.os.Binder.execTransact(Binder.java:446)
04-19 17:18:11.457 16692-28705/android.process.mediaUI W/System.err: android.database.sqlite.SQLiteException: unable to open database file (code 14)
04-19 17:18:11.457 16692-28705/android.process.mediaUI W/System.err: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:181)
04-19 17:18:11.457 16692-28705/android.process.mediaUI W/System.err: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
04-19 17:18:11.457 16692-28705/android.process.mediaUI W/System.err: at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
04-19 17:18:11.457 16692-28705/android.process.mediaUI W/System.err: at android.content.ContentResolver.query(ContentResolver.java:501)
04-19 17:18:11.457 16692-28705/android.process.mediaUI W/System.err: at android.content.ContentResolver.query(ContentResolver.java:436)
04-19 17:18:11.457 16692-28705/android.process.mediaUI W/System.err: at com.android.providers.downloads.marketRelease.XLDownloadManager$Query.runQuery(XLDownloadManager.java:1319)
04-19 17:18:11.457 16692-28705/android.process.mediaUI W/System.err: at com.android.providers.downloads.marketRelease.XLDownloadManager.query(XLDownloadManager.java:1471)
I know that DownloadManager should manage all the downloads and restart them in case of download failure. I don't use SQLite in my app so I believe that DownloadManager is the one who causes the problem.
So what crashes DownloadManager? Can I prevent it from crashing from my code? And is there way to prevent my app from crashing as well?
Related
my application is downloading large files from internet. but during the download i get
E/CursorWindow﹕ Could not create CursorWindow from Parcel due to error -12.
error. I am using download manager.
I get a very long out put part it looks like:
Cursor finalized without prior close()
Cursor finalized without prior close()
Cursor finalized without prior close()
Cursor finalized without prior close()
Cursor finalized without prior close()
Cursor finalized without prior close()
Cursor finalized without prior close()
E/CursorWindow﹕ Could not create CursorWindow from Parcel due to error -12.
E/CursorWindow﹕ Could not create CursorWindow from Parcel due to error -12.
E/CursorWindow﹕ Could not create CursorWindow from Parcel due to error -12.
E/CursorWindow﹕ Could not create CursorWindow from Parcel due to error -12.
E/CursorWindow﹕ Could not create CursorWindow from Parcel due to error -12.
E/CursorWindow﹕ Could not create CursorWindow from Parcel due to error -12.
09-01 23:08:44.241 17397-17615/com.yasna.appsaraai W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
09-01 23:08:44.246 16969-17654/? E/CursorWindow﹕ Could not allocate CursorWindow '/data/data/com.android.providers.downloads/databases/downloads.db' of size 2097152 due to error -12.
09-01 23:08:44.246 16969-17654/? E/JavaBinder﹕ *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=552 (# cursors opened by this proc=4) (# cursors opened by pid 17397=548)
at android.database.CursorWindow.<init>(CursorWindow.java:109)
at android.database.CursorWindow.<init>(CursorWindow.java:100)
at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
at android.database.sqlite.SQLiteCursor.clearOrCreateWindow(SQLiteCursor.java:301)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:139)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:133)
at android.database.CursorToBulkCursorAdaptor.getBulkCursorDescriptor(CursorToBulkCursorAdaptor.java:148)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:118)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
09-01 23:08:44.251 17397-17615/com.yasna.appsaraai W/System.err﹕ java.lang.NullPointerException
09-01 23:08:44.251 17397-17615/com.yasna.appsaraai W/System.err﹕ at af.yasna.appsaraai.ApkFileDownloader$1.run(ApkFileDownloader.java:105)
09-01 23:08:44.251 17397-17615/com.yasna.appsaraai W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
09-01 23:08:44.256 16969-17642/? E/CursorWindow﹕ Could not allocate CursorWindow '/data/data/com.android.providers.downloads/databases/downloads.db' of size 2097152 due to error -12.
09-01 23:08:44.256 16969-17642/? E/JavaBinder﹕ *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=552 (# cursors opened by this proc=4) (# cursors opened by pid 17397=548)
at android.database.CursorWindow.<init>(CursorWindow.java:109)
at android.database.CursorWindow.<init>(CursorWindow.java:100)
at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
at android.database.sqlite.SQLiteCursor.clearOrCreateWindow(SQLiteCursor.java:301)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:139)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:133)
at android.database.CursorToBulkCursorAdaptor.getBulkCursorDescriptor(CursorToBulkCursorAdaptor.java:148)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:118)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
I'm developing on Android 5.0 now, and I get these logs several times just after the device rebooted in low-power state(I'm not sure if low-power is relevant here).
I don't familiar with SQLite, but I have gone through the flow of ext4 file create, read, and how does selinux label the inode, and I don't see how can a ext4 file inode's xattr be corrupted.
In normal, it should appear like this:
u:object_r:system_data_file:s0 locksettings.db-shm
u:object_r:system_data_file:s0 locksettings.db-wal
I'll paste logs later.
Any help is appreciated..Thank you
---Scenario 1:--
**kmsg:**
<12>[ 26.034851s][pid:2758,cpu3,logd.auditd]type=1400 audit(1425430396.379:7):
avc: denied { write } for pid=3244 comm="system_server" name="locksettings.db- shm" dev="mmcblk0p40" ino=430823 scontext=u:r:system_server:s0 tcontext=u:object_r:unlabeled:s0 tclass=file permissive=0
**logcat:**
08:53:16.369 3244 3244 E SQLiteLog: (14) cannot open file at line 28606 of [9491ba7d73]
E SQLiteLog: (14) os_unix.c:28606: (13) open(/data/system/locksettings.db-shm) -
E SQLiteLog: (14) unable to open database file
E SQLiteLog: (14) cannot open file at line 28606 of [9491ba7d73]
E SQLiteLog: (14) os_unix.c:28606: (13) open(/data/system/locksettings.db-shm) -
E SQLiteDatabase: Failed to open database '/data/system/locksettings.db'.
E SQLiteDatabase: android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file(Sqlite code 14): , while compiling: PRAGMA journal_mode,(OS error - 13:Permission denied)
E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:634)
E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:320)
E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:291)
E SQLiteDatabase: at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)
--Scenario 2:--
**kmsg:**
11:58:55.334 <6>[ 26.980468s][pid:3299,cpu4,system_server]SELinux: Context is not valid (left unmapped).
11:58:55.334 <12>[ 26.980743s][pid:2844,cpu0,logd.auditd]type=1400 audit(1425009535.319:5): avc: denied { write } for pid=3299 comm="system_server" name="locksettings.db-wal" dev="mmcblk0p40" ino=16423 scontext=u:r:system_server:s0 tcontext=u:object_r:unlabeled:s0 tclass=file permissive=0
11:58:55.334 <12>[ 26.986572s][pid:2844,cpu0,logd.auditd]type=1400 audit(1425009535.319:6): avc: denied { write } for pid=3299 comm="system_server" name="locksettings.db-wal" dev="mmcblk0p40" ino=16423 scontext=u:r:system_server:s0 tcontext=u:object_r:unlabeled:s0 tclass=file permissive=0
**logcat:**
11:58:55.319 3299 3299 E SQLiteLog: (283) recovered 10 frames from WAL file /data/system/locksettings.db-wal
Did anyone face similar error?
Getting Error: SQLiteLog: (14) cannot open file at line 30241 of [00bb9c9ce4]
SQLiteLog: (14) os_unix.c:30241: (2) open(/NotificationPermissions.db) -
Followed all steps as per below link:
https://developers.google.com/mobile-ads-sdk/docs/admob/advanced
Please see log below:
06-01 16:11:43.613: E/GooglePlayServicesUtil(19506): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
06-01 16:11:43.643: D/LOG_TAG(19506): Interstitial ad was not ready to be shown.
06-01 16:11:43.673: D/dalvikvm(19506): GC_CONCURRENT freed 730K, 16% free 12073K/14279K, paused 6ms+6ms, total 63ms
06-01 16:11:43.724: I/brcm-gr(19506): [gralloc_lock]: new usage 0x933
06-01 16:11:43.764: E/GooglePlayServicesUtil(19506): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
06-01 16:11:43.774: E/GooglePlayServicesUtil(19506): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
06-01 16:11:43.804: D/MainGamePanel(19506): Surface is being destroyed
06-01 16:11:43.804: D/Surface Destroyed(19506): Thread was shut down cleanly
06-01 16:11:43.804: W/SurfaceView(19506): CHECK surface infomation creating=false formatChanged=false sizeChanged=false visible=false visibleChanged=true surfaceChanged=true realSizeChanged=false redrawNeeded=true left=false top=false
06-01 16:11:43.814: W/SurfaceView(19506): CHECK surface infomation creating=false formatChanged=false sizeChanged=false visible=false visibleChanged=false surfaceChanged=false realSizeChanged=false redrawNeeded=false left=false top=false
06-01 16:11:43.824: E/SpannableStringBuilder(19506): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-01 16:11:43.824: E/SpannableStringBuilder(19506): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-01 16:11:43.844: W/SurfaceView(19506): CHECK surface infomation creating=false formatChanged=false sizeChanged=false visible=false visibleChanged=false surfaceChanged=false realSizeChanged=false redrawNeeded=false left=false top=false
06-01 16:12:07.036: W/Ads(19506): Timed out waiting for ad response.
06-01 16:12:07.036: W/Ads(19506): Timed out waiting for ad response.
06-01 16:12:07.086: E/SQLiteLog(19506): (14) cannot open file at line 30241 of [00bb9c9ce4]
06-01 16:12:07.086: E/SQLiteLog(19506): (14) os_unix.c:30241: (2) open(/NotificationPermissions.db) -
06-01 16:12:07.086: D/WebKit(19506): ERROR:
06-01 16:12:07.086: D/WebKit(19506): SQLite database failed to load from /NotificationPermissions.db
06-01 16:12:07.086: D/WebKit(19506): Cause - unable to open database file
06-01 16:12:07.086: D/WebKit(19506): external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) : bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
06-01 16:12:07.096: E/SQLiteLog(19506): (14) cannot open file at line 30241 of [00bb9c9ce4]
06-01 16:12:07.096: E/SQLiteLog(19506): (14) os_unix.c:30241: (2) open(/NotificationPermissions.db) -
06-01 16:12:07.096: D/WebKit(19506): ERROR:
06-01 16:12:07.096: D/WebKit(19506): SQLite database failed to load from /NotificationPermissions.db
06-01 16:12:07.096: D/WebKit(19506): Cause - unable to open database file
06-01 16:12:07.106: D/WebKit(19506): external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) : bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
06-01 16:12:07.106: W/Ads(19506): Failed to load ad: 2
06-01 16:12:07.106: W/Ads(19506): Failed to load ad: 2
This error happened occasionally when I did some user/stress test on Android. Files under /data disapppeared and system server crashed after this error occurred. I am curious about the name of database "contacts2.db-mj7742599A4". Normally it should be contacts2.db. What does "*.db-mj7742599A4" mean? Anyone can help please?
02-28 19:21:43.161 660 695 E SQLiteLog: (14) cannot open file at line 30174 of [00bb9c9ce4]
02-28 19:21:43.169 660 695 E SQLiteLog: (14) os_unix.c:30174: (2) open(/data/data/com.android.providers.contacts/databases/contacts2.db-mj7742599A4) -
02-28 19:21:43.520 397 409 I am_crash: [660,android.process.acore,572933,android.database.sqlite.SQLiteCantOpenDatabaseException,unable to open database file (code 14),SQLiteConnection.java,-2]
02-28 19:21:43.536 397 5671 I am_crash: [397,system_server,-1,java.lang.IllegalArgumentException,NULL,StatFs.java,-2]
I'm trying to execute my android application using phonegap but I'm having the following error when I execute a plugin that i created:
15:33:12.912: E/SQLiteLog(2249): (14) cannot open file at line
30174 of [00bb9c9ce4] 10-31 15:33:12.912: E/SQLiteLog(2249): (14)
os_unix.c:30174: (2) open(/CachedGeoposition.db) - 10-31
15:33:12.912: D/WebKit(2249): ERROR: 10-31 15:33:12.921:
D/WebKit(2249): SQLite database failed to load from
/CachedGeoposition.db 10-31 15:33:12.921: D/WebKit(2249): Cause -
unable to open database file 10-31 15:33:12.921: D/WebKit(2249):
external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) :
bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
By the way, I'm not using a sqlite database