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

Data wiped due to database corruption #2463

Closed
oskarkook opened this issue Oct 23, 2017 · 246 comments
Closed

Data wiped due to database corruption #2463

oskarkook opened this issue Oct 23, 2017 · 246 comments
Labels
Type: Confirmed bug Bugs confirmed by a lead developer

Comments

@oskarkook
Copy link

oskarkook commented Oct 23, 2017

App version: 1.6.4.1 (commit cef7006) (from Google Play)
Android version: 7.0
Current behaviour: Have been using AntennaPod for 1-2 months. I moved my data from Internal Storage to SD card ~1 week ago. Had subscription updates on (every 12hrs I think). It started automatically, I opened the app to check on it, it froze for 1-2 seconds and then most of my data was wiped (app has no subscriptions, playback history empty etc).

/Android/data/de.danoeh.antennapod/files/ contains the following:

  • cache/ has 2 files of 2 subscriptions. I had 25 subscriptions.
  • import/ empty
  • media/ directories of 6 subscriptions. Still contains some pre-downloaded episodes.

First occured: 22.10.2017
Steps to reproduce: Not sure

I still have the old data (1 week old) on my Internal Storage. The cache/ folder there seems to at least contain all my old feeds. Any way I can recover something from there?

@oskarkook oskarkook changed the title Data wiped during episode updates Data wiped during subscription updates Oct 23, 2017
@mfietz
Copy link
Contributor

mfietz commented Oct 23, 2017

Is it possible that this is an external storage issue? It is not uncommon for SD cards to corrupt.

I don't see how updating the app could have removed some of the files while keeping others in place.

@muethingjt
Copy link

muethingjt commented Oct 24, 2017

Just had the same issue. I'm not using an external storage/SD card and all my podcast files are still in /Android/data/de.danoeh.antennapod/files/ but the app is showing no subscriptions, downloads, or download history. The data is still on my phone but the app isn't recognizing it.

Edit: Should have mentioned Android version. I'm using Android 6.0.1 on a Galaxy S5

@aaguilera
Copy link

Same issue here: all my feeds gone. Using Android 6.0.1 on a Nexus 5.

@thelstew
Copy link

I'm on a Galaxy 5, Android 6.0.1
Went to download a few episodes of a podcast, it wouldn't load the list of episodes, then when I stopped it from looking and went to the queue there was nothing and all subscriptions gone. Just empty! Restarted phone, no change. 40-something hours of material gone.

@LordKawaii
Copy link

Same problem as thelstew. Went to download some new episodes and lost everything

@LordKawaii
Copy link

Oh. I am on a galaxy 5

@brarcher
Copy link

brarcher commented Nov 2, 2017

This is an additional report of all data being wiped from the application. The phone is running LineageOS 14.1 (Android 7.1.2) on a Galaxy S4 with AntennaPod 1.6.4.1 from F-Droid.

The sequence of steps was the following:

  1. Entered application, splash screen loaded, landed in Queue view. Expected data was loaded.
  2. Refreshed subscriptions, completed
  3. Scrolled through drawer to find a specific subscription. Clicked on it.
  4. Cannot recall what I saw next, but the load appeared to fail or said there was no content.
  5. When I returned to the Queue screen all downloaded podcasts were gone. In additional, all subscriptions were gone.

The following are the logs from that time. Unfortunately, nothing looks that out of place.

11-02 19:12:28.214 I/ActivityManager(  600): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.teslacoilsw.launcher/.NovaLauncher (has extras)} from uid 1000 on display 0
11-02 19:12:28.314 W/RenderThread( 2273): type=1400 audit(0.0:1431): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11273 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
11-02 19:12:28.314 W/RenderThread( 2273): type=1300 audit(0.0:1431): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=a761407a a2=20000 a3=0 items=1 ppid=256 auid=4294967295 uid=10082 gid=10082 euid=10082 suid=10082 fsuid=10082 egid=10082 sgid=10082 fsgid=10082 tty=(none) ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
11-02 19:12:28.314 W/auditd  (  218): type=1307 audit(0.0:1431): cwd="/"
11-02 19:12:28.314 W/auditd  (  218): type=1302 audit(0.0:1431): item=0 name="/sys/class/kgsl/kgsl-3d0/gpuclk" inode=11273 dev=00:0d mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=u:object_r:sysfs:s0
11-02 19:12:28.314 W/auditd  (  218): type=1320 audit(0.0:1431): 
11-02 19:12:28.318 I/Adreno-EGL( 2210): <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
11-02 19:12:28.319 I/OpenGLRenderer( 2210): Initialized EGL, version 1.4
11-02 19:12:28.319 D/OpenGLRenderer( 2210): Swap behavior 1
11-02 19:12:28.323 W/Adreno-ES20( 2210): <get_gpu_clk:229>: open failed: errno 13
11-02 19:12:28.565 I/Keyboard.Facilitator( 4398): onFinishInput()
11-02 19:12:29.140 W/art     (21669): Long monitor contention with owner GLThread 3715 (21700) at void android.opengl.GLSurfaceView$GLThread.guardedRun()(GLSurfaceView.java:1310) waiters=1 in void java.lang.Object.wait!() for 224ms
11-02 19:12:30.550 D/AudioService(  600): Stream muted, skip playback
11-02 19:12:30.556 I/ActivityManager(  600): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=de.danoeh.antennapod/.activity.SplashActivity bnds=[540,1044][810,1368] (has extras)} from uid 10082 on display 0
11-02 19:12:30.680 I/ActivityManager(  600): Start proc 25943:de.danoeh.antennapod/u0a68 for activity de.danoeh.antennapod/.activity.SplashActivity
11-02 19:12:30.862 D/ro      (12607): inflating media notification
11-02 19:12:30.982 I/art     (25943): Starting a blocking GC AddRemoveAppImageSpace
11-02 19:12:30.995 W/System  (25943): ClassLoader referenced unknown path: /mnt/expand/77ce1534-5a43-426c-af16-32c490dc01b9/app/de.danoeh.antennapod-2/lib/arm
11-02 19:12:31.696 I/ActivityManager(  600): START u0 {cmp=de.danoeh.antennapod/.activity.MainActivity} from uid 10068 on display 0
11-02 19:12:31.708 W/ActivityManager(  600): Duplicate finish request for ActivityRecord{b86d716 u0 de.danoeh.antennapod/.activity.SplashActivity t1443 f}
11-02 19:12:32.555 W/WindowManager(  600): Failed looking up window
11-02 19:12:32.555 W/WindowManager(  600): java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W@f65a61c does not exist
11-02 19:12:32.555 W/WindowManager(  600): 	at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9469)
11-02 19:12:32.555 W/WindowManager(  600): 	at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9460)
11-02 19:12:32.555 W/WindowManager(  600): 	at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2401)
11-02 19:12:32.555 W/WindowManager(  600): 	at com.android.server.wm.Session.remove(Session.java:202)
11-02 19:12:32.555 W/WindowManager(  600): 	at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3290)
11-02 19:12:32.555 W/WindowManager(  600): 	at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5923)
11-02 19:12:32.555 W/WindowManager(  600): 	at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3629)
11-02 19:12:32.555 W/WindowManager(  600): 	at android.os.Handler.dispatchMessage(Handler.java:102)
11-02 19:12:32.555 W/WindowManager(  600): 	at android.os.Looper.loop(Looper.java:154)
11-02 19:12:32.555 W/WindowManager(  600): 	at android.os.HandlerThread.run(HandlerThread.java:61)
11-02 19:12:32.555 W/WindowManager(  600): 	at com.android.server.ServiceThread.run(ServiceThread.java:46)
11-02 19:12:33.045 I/ActivityManager(  600): Displayed de.danoeh.antennapod/.activity.MainActivity: +843ms (total +2s412ms)
11-02 19:12:33.052 I/Keyboard.Facilitator( 4398): onFinishInput()
11-02 19:12:33.260 D/NetworkSecurityConfig(25943): No Network Security Config specified, using platform default
11-02 19:12:33.291 E/wifi    (  600): wifi_get_supported_feature_set returned error = 0xffffffa1
11-02 19:12:33.292 E/BatteryStatsService(  600): no controller energy info supplied
11-02 19:12:33.292 E/BatteryStatsService(  600): no controller energy info supplied
11-02 19:12:33.313 E/BatteryStatsService(  600): modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
11-02 19:12:33.478 E/MediaPlayer-JNI(25943): JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
11-02 19:12:33.478 E/MediaPlayer-JNI(25943): JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0
11-02 19:12:33.791 I/FFmpegExtractor(  264): android-source:0xb3314000
11-02 19:12:33.845 I/FFmpegExtractor(  264): android-source:0xb3317200
11-02 19:12:33.905 I/FFmpegExtractor(  264): android-source:0xb35ed400
11-02 19:12:33.998 I/FFMPEG  (  264): Last message repeated 1 times
11-02 19:12:33.998 I/FFMPEG  (  264): [mp3 @ 0xb5fb5200] Skipping 0 bytes of junk at 814743.
11-02 19:12:33.998 D/FFmpegExtractor(  264): supported codec (mp3) by official Stagefright
11-02 19:12:33.998 D/FFmpegExtractor(  264): ffmpeg detected media content as 'audio/mpeg' with confidence 0.08
11-02 19:12:34.055 I/FFMPEG  (  264): [mp3 @ 0xb5fb4c00] Skipping 0 bytes of junk at 814743.
11-02 19:12:34.055 D/FFmpegExtractor(  264): supported codec (mp3) by official Stagefright
11-02 19:12:34.056 D/FFmpegExtractor(  264): ffmpeg detected media content as 'audio/mpeg' with confidence 0.08
11-02 19:12:34.097 I/FFMPEG  (  264): [mp3 @ 0xb5fb5800] Skipping 0 bytes of junk at 814743.
11-02 19:12:34.097 D/FFmpegExtractor(  264): supported codec (mp3) by official Stagefright
11-02 19:12:34.097 D/FFmpegExtractor(  264): ffmpeg detected media content as 'audio/mpeg' with confidence 0.08
11-02 19:12:34.111 I/art     (25943): Background sticky concurrent mark sweep GC freed 1322(54KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 11MB/11MB, paused 5.645ms total 17.974ms
11-02 19:12:34.131 D/AudioTrack(25943): Client defaulted notificationFrames to 4714 for frameCount 14144
11-02 19:12:34.138 I/MediaPlayerService(  265): MediaPlayerService::getOMX
11-02 19:12:34.139 I/OMXClient(25943): MuxOMX ctor
11-02 19:12:34.142 I/OMXMaster(  261): makeComponentInstance(OMX.google.mp3.decoder) in mediacodec process
11-02 19:12:34.162 D/AudioService(  600): Stream muted, skip playback
11-02 19:12:34.169 I/System.out(25943): TagHeader [version=̀, flags=0, id=ID3, size=814733]
11-02 19:12:34.169 I/System.out(25943): FrameHeader [flags=0, id=TCON, size=1001]
11-02 19:12:34.171 I/System.out(25943): FrameHeader [flags=0, id=TIT2, size=100111]
11-02 19:12:34.171 I/System.out(25943): FrameHeader [flags=0, id=TPE1, size=1101]
11-02 19:12:34.172 I/System.out(25943): FrameHeader [flags=0, id=TALB, size=1101]
11-02 19:12:34.172 I/System.out(25943): FrameHeader [flags=0, id=TXXX, size=1011]
11-02 19:12:34.172 I/System.out(25943): FrameHeader [flags=0, id=TSSE, size=1110]
11-02 19:12:34.174 I/System.out(25943): FrameHeader [flags=0, id=APIC, size=11000110110111100100]
11-02 19:12:34.175 I/System.out(25943): Reached end of tag
11-02 19:12:34.177 I/System.out(25943): No vorbis comment found
11-02 19:12:34.263 E/wifi    (  600): wifi_get_supported_feature_set returned error = 0xffffffa1
11-02 19:12:34.263 E/BatteryStatsService(  600): no controller energy info supplied
11-02 19:12:34.373 E/wifi    (  600): wifi_get_supported_feature_set returned error = 0xffffffa1
11-02 19:12:34.373 E/BatteryStatsService(  600): no controller energy info supplied
11-02 19:12:34.695 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:34.941 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:35.150 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:35.395 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:35.609 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:35.902 I/art     (12607): Background partial concurrent mark sweep GC freed 183413(10MB) AllocSpace objects, 11(16MB) LOS objects, 40% free, 14MB/24MB, paused 762us total 120.910ms
11-02 19:12:35.908 I/art     (  600): Background partial concurrent mark sweep GC freed 74919(6MB) AllocSpace objects, 4(240KB) LOS objects, 33% free, 18MB/28MB, paused 2.532ms total 152.679ms
11-02 19:12:36.172 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:36.369 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:36.583 I/PowerManagerService(  600): Going to sleep due to power button (uid 1000)...
11-02 19:12:36.586 I/Keyboard.Facilitator( 4398): onFinishInput()
11-02 19:12:36.588 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:36.596 W/FingerprintManager(12607): isFingerprintHardwareDetected(): Service not connected!
11-02 19:12:36.598 W/Adreno-EGL(  600): <qeglDrvAPI_eglQueryContext:4373>: EGL_BAD_ATTRIBUTE
11-02 19:12:36.857 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:37.122 W/ConnectivityExtension(  600): ConnectivityExt jar file not present
11-02 19:12:37.199 I/VrManagerService(  600): VR mode is disallowed
11-02 19:12:37.203 E/Sensors (  600): Acc old sensor_state 129, new sensor_state : 128 en : 0
11-02 19:12:37.205 V/KeyguardServiceDelegate(  600): onScreenTurnedOff()
11-02 19:12:37.220 E/LightSensor(  600): Light old sensor_state 128, new sensor_state : 0 en : 0
11-02 19:12:37.223 I/DisplayManagerService(  600): Display device changed state: "Built-in Screen", OFF
11-02 19:12:37.224 D/SurfaceFlinger(  242): Set power mode=0, type=0 flinger=0xb68ab000
11-02 19:12:37.228 D/qdhwcomposer(  242): hwc_setPowerMode: Setting mode 0 on display: 0
11-02 19:12:37.518 D/qdhwcomposer(  242): hwc_setPowerMode: Done setting mode 0 on display 0
11-02 19:12:37.518 D/SurfaceControl(  600): Excessive delay in setPowerMode(): 295ms
11-02 19:12:37.543 I/QCOM PowerHAL(  600): Got set_interactive hint
11-02 19:12:37.544 I/PowerManagerService(  600): Sleeping (uid 1000)...
11-02 19:12:37.548 W/FingerprintManager(12607): isFingerprintHardwareDetected(): Service not connected!
11-02 19:12:37.551 D/audio_hw_primary(  257): adev_set_parameters: enter: screen_state=off
11-02 19:12:37.745 I/WindowManager(  600): OverscanTimeout run
11-02 19:12:42.045 I/ActivityManager(  600): Setting hasTopUi=true for pid=12607
11-02 19:12:42.079 D/CarrierText(12607): onSimStateChanged: Normal
11-02 19:12:42.130 D/PhoneStatusBar(12607): disable: < expand ICONS* alerts SYSTEM_INFO* back home recent clock search quick_settings >
11-02 19:12:42.151 W/FingerprintManager(12607): isFingerprintHardwareDetected(): Service not connected!
11-02 19:12:42.160 W/FingerprintManager(12607): isFingerprintHardwareDetected(): Service not connected!
11-02 19:12:42.209 W/View    (12607): requestLayout() improperly called by com.android.systemui.statusbar.ExpandableNotificationRow{2d363d1 VFE...C.. ......ID 0,0-1080,276} during layout: running second layout pass
11-02 19:12:42.215 W/FingerprintManager(12607): isFingerprintHardwareDetected(): Service not connected!
11-02 19:12:42.220 D/PhoneStatusBar(12607): disable: < expand ICONS alerts SYSTEM_INFO back HOME* RECENT* clock SEARCH* quick_settings >

@LivInTheLookingGlass
Copy link

When it happened to me, I was watching it update in the Episodes view. As I was watching, one of the downloads stopped updating, and then all three episodes disappeared. I opened the drawer, and no subscriptions were visible, with the queue empty.

@mfietz
Copy link
Contributor

mfietz commented Nov 27, 2017

There seem to be more and more users affected by this.
There are a few things that really bug me:

  • Randomness: There doesn't seem to be a reliable way to reproduce this issue
  • The database should only be ever wiped when sqlite detects that it is corrupted. There should not be any way that we can corrupt a database by using it. This should just not happen.
  • I see a lot of Galaxy devices in this bug report...

@basti2342
Copy link

I am also affected. I did also watch my subscriptions getting updated and suddenly AntennaPod is completely empty - no downloads, no subscriptions - everything gone.

App version: 1.6.4.1
Android version: 8.0.0
Device: Nexus 5x

I checked /Android/data/de.danoeh.antennapod/files/ and the files are still there.

Is there anything I can do to help debug this?

@thelstew
Copy link

thelstew commented Nov 27, 2017 via email

@LivInTheLookingGlass
Copy link

To be clear @mfietz, I'm on a Nexus 6P with LineageOS.

A temporary solution would be to make an OPML export every time subscriptions change. At least that would allow us to restore that much.

@brarcher
Copy link

brarcher commented Dec 1, 2017

I've hit this a second time. Very soon after after hitting the refresh menu option to download updated podcast information the database was wiped. This time I captured a bug report right after the issue, and found the following in the logs around the time of the issue:

12-01 08:35:36.238 12021 19056 E SQLiteLog: (26) file is encrypted or is not a database
12-01 08:35:36.239 12021 19056 E DefaultDatabaseErrorHandler: Corruption reported by sqlite on database: /mnt/expand/77ce1534-5a43-426c-af16-32c490dc01b9/user/0/de.danoeh.antennapod/databases/Antennapod.db
12-01 08:35:36.240 12021 19056 E DefaultDatabaseErrorHandler: deleting the database file: /mnt/expand/77ce1534-5a43-426c-af16-32c490dc01b9/user/0/de.danoeh.antennapod/databases/Antennapod.db

So, it would appear that SQLite believed the database was corrupt and deleted it as a result. The app's storage was set to an external SD card, which is less than 1 year old. No other app is reporting issues with that storage, but it cannot be ruled out. In response, I've changed the apps storage to internal.

@basti2342
Copy link

A quick note: in my case the potential database corruption happened on the internal storage of my Nexus 5x. I didn't notice any other storage/file system problems on my device.

@LivInTheLookingGlass
Copy link

I was also running on internal storage. I don't think storage corruption is the root cause here.

@msagebiel
Copy link

moto g 2014 titan lineageos, happened here on external card

@brarcher
Copy link

The phone is running LineageOS 14.1
I'm on a Nexus 6P with LineageOS.
moto g 2014 titan lineageos

Just to be sure, has anyone hit this who is not running LineageOS?

@aaguilera
Copy link

Yes, @brarcher. I had the issue on stock Android 6.0.1 on a Nexus 5.

@ejstacey
Copy link

I'm also seeing this. It has happened twice.

LG v20, Android 7 stock
AntennaPod, Version 1.6.4.1
Commit: cef7006
From F-droid
Internal storage, although an SD card is plugged in.

@mfietz
Copy link
Contributor

mfietz commented Dec 11, 2017

@ejstacey can you export your subscriptions to OPML and send me the file to martin.fietz 'at' gmail.com ?

@ejstacey
Copy link

I have emailed you an OPML file.

Here's some activity/other notes, if it helps:

I had it on on the way home (Bluetooth through car) when I got interrupted by a call. Antennapod stopped/started on its own fine. I always have Bluetooth going through the car, but I very very rarely receive a call, so that's out of the ordinary. I don't know if it's related, but I thought I'd mention it just in case it is.

I have Update Interval set to every 4 hours. I have Enqueue Downloaded enabled. I have 4 parallel downloads set up. I have Automatic Download enabled, and have it set to Download when not charging.

@gybaryan
Copy link

I am also affected. CM13 / 6.0.1 OnePlus One, so internal storage only. Version 1.6.4.1

@sapolion
Copy link

Galaxy S6 running Android 7.0 - something happened while updating and all the subscriptions, history, queue, etc. vanished. I am guessing it just got corrupted and that I should make it a point to regularly export an OPML file with my subscriptions. I am looking through the above comments which are actually helpful since I don't mind resubscribing but will need to look for the saved data manually wherever it is stored and it will probably take me a month to figure out everything I was subscribed too - maybe there is some limit on how much data the app can track?

@ejstacey
Copy link

I just hit the issue again, but I'm not sure there was a subscription update going on. I opened the app, and a podcast I had been listening to earlier only had a minute left when I had paused it. I have the 'delete if stopped with only a few minutes left' option turned on, fwiw. Anyway, I went to the queue and long pressed on a different episode and said 'remove from queue'. Nothing disappeared (lock on sqlite database between the autodeleter and my action? No idea!). I then long pressed on a different podcast (the one that only had a minute left) and said 'remove from queue'. Then everything disappeared (queue, subscriptions, etc).

@diemade
Copy link

diemade commented Dec 24, 2017

oh noes, same here:
App version 1.6.4.1 commit cef7006 on Samsung Galaxy S3 GT-I9300 with Android 6.0.1;

I dont think feeds wee updating when everything crashed and deleted feeds, watched-status and so on.
Files (on phone) are still there. Phone memory was somewhat close to full at the time but plenty for update operation.

@ejstacey
Copy link

ejstacey commented Jan 5, 2018

Just hit it again. I was partway through two podcasts. Podcast B I last listened to a couple hours ago when I paused it. Podcast A I last listened to a few days ago. I opened the app, which I think did a refresh operation. I hit podcast A while that was happening. It didn't play anything, just nothing. I hit podcast B. Nothing. I hit the hamburger icon to open the menu and everything disappeared. While it was in the broken/frozen state, I could scroll up+down through my queue.

@cDawny
Copy link

cDawny commented Jan 8, 2018

I'm also affected by this whole "everything vanished" thing. :(

Google Pixel, stock Android version 8.1.0
AntennaPod Version 1.6.4.4, commit 8b84b70

Opened a subscription to download further episodes, the list didn't load and suddenly everything was gone!

Was anyone of you guys able to restore their previous data? I welcome even the whackiest solution!

@brarcher
Copy link

brarcher commented Jan 9, 2018

The only restoring which I attempted was importing a previously exported OPLM file which backs up all the podcast subscriptions. Any previously downloaded podcasts might still be there, but they may not be usable by the app.

@drkthomp
Copy link

Since I don't think there's a report for 2.1.2 and just to add more data, my database corrupted, I think while adding podcasts. I only noticed at ~20:45:03.522 but the error log states this:
01-20 18:54:28.285 6673 7220 E AndroidRuntime: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/de.danoeh.antennapod/databases/Antennapod.db
which I suspect is when the error occurred. I didn't notice anything unusual when adding the podcasts but I think I navigated away before the second one added.

Ironically the two podcasts I added are now showing up in AntennaPod, but all my other podcasts are gone. For database size, I believe I had over 100 and I had ~450 episodes actively in my queue. I've had this many podcasts for multiple months and never run into an issue. Podcasts sorted by publication date. I also subscribed to some Youtube feeds, though only about 4. Nothing in my behaviour has changed for months regarding my usage.

The podcast I was playing remained in the "notification" but nothing happened when I pressed play (I think this is where the PlayableUtils in the full-logs.txtcome from).

Environment:
Android version 9, kernel version 4.4.146+
Antennapod Version: 2.1.2 (a87cec5) from F-Droid
Model: Teracube One
Device: Teracube One

Files stored in /sdcard/Android/data/de.danoeh.antennapod/ (internal storage). There's a 'CorruptedDatabaseBackup.db' created at 18:54 but its file size is 0. OPML export of my list only outputs the two 'new' podcasts. An export of the db also only includes those two.

Just to be complete, in files/cache, I have some 'feed' files with no file ending (ie, feed-World Ocean-Radio-4.) which seem kind of wacky, given that feed-World Ocean-Radio-n exists for 1-33 with each number going up in creation time, from June to November last year. Attempting to OPML import shows nothing in them.
In cache/ I have one feed, also empty.
In media all my downloaded podcasts still exist at least! copying them for backup currently.

My /data/user/0/de.danoeh.antennapod/databases only has the new .db file with the two podcasts.

@ByteHamster
Copy link
Member

We disabled WriteAheadLogging (WAL) for the database at some point because it breaks database exports. Maybe we should write another way to export the database (using proper sqlite to copy the database instead of just copying the file) and re-enable WAL. If anyone is up for rewriting the backup feature, that would be greatly appreciated :)

@ByteHamster
Copy link
Member

Hmm. Maybe the missing synchronization here actually is the problem?

@antennapod-bot
Copy link

This issue has been mentioned on AntennaPod Forum. There might be relevant details there:

https://forum.antennapod.org/t/i-lost-my-data-and-i-no-have-idea-about-i-lost-this/1009/2

@antennapod-bot
Copy link

This issue has been mentioned on AntennaPod Forum. There might be relevant details there:

https://forum.antennapod.org/t/i-lost-my-data-and-i-no-have-idea-about-i-lost-this/1009/4

@qguv
Copy link

qguv commented Dec 27, 2021

This happened to me today with 2.4.1—I started the app but everything in there is gone, as if the db was wiped. My 27GB of downloaded podcasts are still on the filesystem though. The full-log.txt on the bug report screen has no history before the wipe.

The database and all app data was stored in the default location on internal storage. I don't have an SD card installed.

Screenshots:

Android version: 10
OS version: 4.14.113-user+
AntennaPod version: 2.4.1

@antennapod-bot
Copy link

This issue has been mentioned on AntennaPod Forum. There might be relevant details there:

https://forum.antennapod.org/t/all-gone-podcasts-and-episodes-as-if-i-just-installed-the-app/1593/2

@tonytamsf
Copy link
Member

@ByteHamster Should we add more custom bug reporting logic here when we detect a corrupt db when there is a corrupt database and ask users to share some data with us and directly into this specific ticket?

@keunes
Copy link
Member

keunes commented Jan 1, 2022

And/or a link to instructions on the website on how to recover the data (there are some options/instructions both in this issue and on the forum).

@ByteHamster
Copy link
Member

ask users to share some data with us and directly into this specific ticket?

I don't know what data they could share that would help. I'm pretty much out of ideas here. A rather similar issue seems to happen in K-9 Mail. Maybe corrupted databases are just a thing that occasionally happens when running an app on thousands of devices?

@jsteel44
Copy link

I had this issue occur a few times in a fairly short space of time (this was at least 2 years ago) but then haven't had the issue since (still on the same phone after about 4 years). I was once active in this thread (I was running a suspect version for some time) but thought I'd share that it does just seem random. I then have been updating to the latest version without issue. The backup feature is handy and I do that occasionally in case it strikes again.

@AbelLykens
Copy link

I have had this often, too, but not anymore since I switched to a phone without SD. Could have been some version that fixed it, too of course.

One thing that could help users a bit is automatic backups, weekly for example. #4850

@hans-eat-ic
Copy link

Hi,
I have an empty Antennapod, too.
I've tried both approaches from https://antennapod.org/documentation/bugs-first-aid/database-error both refer to rather old versions.
My system:
AntennaPod version: 2.4.1
Android Version: 9
SD card installed, relevant Data was on internal storage

My CorruptedDatabaseBackup.db starts with
SQLite format so I did not change anything there.
1st repair approach:
sqlite3 CorruptedDatabaseBackup.sqlite ".dump" > recovery.sqlite produces a 52Byte file from the 56Mb CorruptedDatabaseBackup.db (Not good I suppose)
2nd approach:
sqlite> attach "CorruptedDatabaseBackup.db" as old;
returns:
Error: database disk image is malformed

Not sure what I can do from here.

@ByteHamster
Copy link
Member

Looks like this issue is solved, meaning that no new databases are getting corrupted since about 4 years. Because of the past corruption, there might be later effects, like the database breaking years later on some unrelated operation. For this, we have issue #6212 to add a better error message and explain users how they can recover the database. Unfortunately, repairing (or even detecting) the quirks on a phone does not work on most Android versions. So we cannot really do more about this here in this issue.

@graue70
Copy link

graue70 commented Sep 22, 2023

Looks like this issue is solved, meaning that no new databases are getting corrupted since about 4 years.

I dare say this is incorrect. The problem just happened to me. I started using the app in 2022.

One funny thing: Even though the app itself has no content whatsoever, the widget (don't know whether that is the correct word) on top of the Android notifications still shows me the banner and title of the last episode I was listening to. If I touch it, the empty queue opens.

One other thing to notice: I previously removed some elements from the sidebar in the app settings. Those settings are still in place. Are they not stored in the same db?

I'm on a Galaxy S10 with LineageOS 20 (Android 13) and recently upgraded the app to 3.1.0.

I guess I'll try to find a way to fix the db in the forum.

@alphapapa
Copy link

@graue70 Thanks for the report. Guess we'd better keep making periodic backups of our databases.

@keunes
Copy link
Member

keunes commented Sep 23, 2023

Sorry to hear @graue70. Please have a look here if you haven't already: https://antennapod.org/documentation/bugs-first-aid/database-error You might still be able to recover your data.

Those settings are still in place. Are they not stored in the same db?

That's correct. See also #4089.

@graue70
Copy link

graue70 commented Sep 27, 2023

  • Open file in hex editor and replace SQLit��� ��Ft 3 with SQLite format 3
  • sqlite3 CorruptedDatabaseBackup.sqlite ".dump" > recovery.sqlite
  • Delete .BEGIN TRANSACTION; in the front and .ROLLBACK; in the back
  • cat recovery.sqlite | sqlite3 recovery.db
  • recovery.db can be opened in SQLite Viewer but not in AntennaPod :(

I took a look at the CorruptedDatabaseBackup.db file with a hex editor. The first line in the file is fine so the first quoted suggestion does not apply. The second suggestion is confusing because my file has the 'db' extension, not 'sqlite'. Also, I did not find the "begin transaction" and "rollback" words in the file. In any case, the resulting file can be imported in the app but leads to a crash on the first start. (The error was 'table Feeds already exists'.)

Funny thing: I can import the unchanged CorruptedDatabaseBackup.db file in the app and temporarily continue using it. It only seems to crash a little later after I update the feeds.

I'm prepared to create a new db, fill it manually through the app and lose my history data in the process unless somebody here has some other advice for me?

@ByteHamster
Copy link
Member

You can try something like this, which automates what is described here:

#!/bin/python
import subprocess
import json
import shutil

corruptedPath = input("Enter file path to your corrupted AntennaPod database: ")
corruptedVersion = subprocess.run(["sqlite3", corruptedPath, "PRAGMA user_version;"], capture_output=True, text=True).stdout.strip()
if corruptedVersion == "0":
    print("Error: File not found, not a database, or too corrupted for this script.")
    exit()
print("Corrupted file version: " + corruptedVersion)

emptyPath = input("Enter file path to an EMPTY AntennaPod database with the same version. If needed, you can download old app versions on F-Droid and export an empty database: ")
emptyVersion = subprocess.run(["sqlite3", emptyPath, "PRAGMA user_version;"], capture_output=True, text=True).stdout.strip()
print("Empty file version: " + emptyVersion)
if corruptedVersion != emptyVersion:
    print("Error: Version does not match")
    exit()
outputPath = corruptedPath + "-repaired.db"
shutil.copyfile(emptyPath, outputPath, follow_symlinks=True)

def query(db, query):
    result = ""
    try:
        result = subprocess.run(["sqlite3", "-json", db, query], capture_output=True, check=True, text=True).stdout
        return json.loads(result)
    except subprocess.CalledProcessError as err:
        print(err.stderr)
        exit()
    except json.decoder.JSONDecodeError as err:
        return result

tables = query(emptyPath, "SELECT name FROM sqlite_schema WHERE type ='table';")

for table in tables:
    table = table["name"]
    print("Copying " + table + "...")
    columns = query(emptyPath, "SELECT GROUP_CONCAT(NAME,',') AS columns FROM PRAGMA_TABLE_INFO('" + table + "')")[0]["columns"]
    query(outputPath, "DELETE FROM " + table)
    query(outputPath, "attach '" + corruptedPath + "' AS old; INSERT INTO main." + table + " SELECT * from old." + table + ";")

print("Done. Output file: " + outputPath)

@graue70
Copy link

graue70 commented Sep 27, 2023

Thanks for the hint. Running your script yields this:

Corrupted file version: 3010000
Empty file version: 3010000
Copying android_metadata...
Copying Feeds...
Copying sqlite_sequence...
Copying FeedItems...
Error: stepping, database disk image is malformed (11)

Running sqlite3 CorruptedDatabaseBackup.db "PRAGMA integrity_check;" yields this:

Details

*** in database main ***
Tree 6 page 4354 cell 0: invalid page number 4359
Tree 6 page 3759 cell 0: Bad ptr map entry key=4359 expected=(3,3759) got=(3,4354)
Tree 6 page 3759 cell 0: invalid page number 4359
Tree 6 page 4158 cell 0: Bad ptr map entry key=4360 expected=(3,4158) got=(4,4353)
Tree 6 page 4158 cell 0: invalid page number 4360
Tree 6 page 3027 cell 1: Bad ptr map entry key=3745 expected=(3,3027) got=(4,2725)
Tree 6 page 2936 cell 1: Bad ptr map entry key=3044 expected=(3,2936) got=(3,3027)
Tree 6 page 2936 cell 1: Bad ptr map entry key=2725 expected=(4,3044) got=(3,4158)
Tree 6 page 2913 cell 0: Bad ptr map entry key=2397 expected=(3,2913) got=(4,2546)
Tree 6 page 2913 cell 0: Bad ptr map entry key=2546 expected=(4,2397) got=(3,2936)
Tree 6 page 2867 cell 1: Bad ptr map entry key=4073 expected=(3,2867) got=(4,3748)
Tree 6 page 2867 cell 1: Bad ptr map entry key=3748 expected=(4,4073) got=(3,2913)
Tree 6 page 2867 cell 1: Bad ptr map entry key=4361 expected=(4,3748) got=(4,3814)
Tree 6 page 2867 cell 1: invalid page number 4361
Tree 6 page 2206 cell 0: Bad ptr map entry key=3814 expected=(3,2206) got=(4,3515)
Tree 6 page 2760 cell 0: Bad ptr map entry key=1546 expected=(3,2760) got=(3,2206)
Tree 6 page 4273 cell 1: Bad ptr map entry key=1764 expected=(3,4273) got=(3,2760)
Tree 6 page 4273 cell 1: Bad ptr map entry key=4361 expected=(4,1764) got=(4,3814)
Tree 6 page 4273 cell 1: invalid page number 4361
Tree 6 page 1143 cell 0: Bad ptr map entry key=1239 expected=(3,1143) got=(3,4273)
Tree 6 page 4136 cell 4: Bad ptr map entry key=1202 expected=(3,4136) got=(3,1143)
Tree 6 page 4048 cell 0: Bad ptr map entry key=1362 expected=(3,4048) got=(3,4136)
Tree 6 page 3860 cell 1: Bad ptr map entry key=1556 expected=(3,3860) got=(3,4048)
Tree 6 page 3860 cell 1: Bad ptr map entry key=2987 expected=(4,1556) got=(4,1362)
Tree 6 page 1809 cell 1: Bad ptr map entry key=1741 expected=(3,1809) got=(3,3860)
Tree 6 page 3830 cell 0: Bad ptr map entry key=1561 expected=(3,3830) got=(3,1809)
Tree 6 page 3755 cell 0: Bad ptr map entry key=1469 expected=(3,3755) got=(3,3830)
Tree 6 page 3755 cell 0: Bad ptr map entry key=3515 expected=(4,2911) got=(3,2867)
Tree 6 page 2547 cell 1: Bad ptr map entry key=2917 expected=(3,2547) got=(4,1563)
Tree 6 page 1706 cell 0: Bad ptr map entry key=1325 expected=(3,1706) got=(2,0)
Tree 6 page 1704 cell 0: Bad ptr map entry key=1514 expected=(3,1704) got=(3,1706)
Tree 6 page 1702 cell 0: Bad ptr map entry key=1183 expected=(3,1702) got=(3,1704)
Tree 6 page 1700 cell 0: Bad ptr map entry key=1134 expected=(3,1700) got=(3,1702)
Tree 6 page 1698 cell 0: Bad ptr map entry key=1378 expected=(3,1698) got=(3,1700)
Tree 6 page 1695 cell 0: Bad ptr map entry key=1492 expected=(3,1695) got=(3,1698)
Tree 6 page 1693 cell 0: Bad ptr map entry key=1692 expected=(3,1693) got=(3,1695)
Tree 6 page 1691 cell 0: Bad ptr map entry key=981 expected=(3,1691) got=(3,1693)
Tree 6 page 1127 cell 0: Bad ptr map entry key=1401 expected=(3,1127) got=(3,1691)
Tree 6 page 1689 cell 0: Bad ptr map entry key=1283 expected=(3,1689) got=(3,1127)
Tree 6 page 1685 cell 0: Bad ptr map entry key=1662 expected=(3,1685) got=(3,1689)
Tree 6 page 1683 cell 0: Bad ptr map entry key=1313 expected=(3,1683) got=(3,1685)
Tree 6 page 1159 cell 0: Bad ptr map entry key=1684 expected=(3,1159) got=(3,1683)
Tree 6 page 1861 cell 0: Bad ptr map entry key=978 expected=(3,1861) got=(3,1159)
Tree 6 page 1679 cell 0: Bad ptr map entry key=1137 expected=(3,1679) got=(3,1861)
Tree 6 page 1677 cell 0: Bad ptr map entry key=1680 expected=(3,1677) got=(3,1679)
Tree 6 page 1675 cell 0: Bad ptr map entry key=1168 expected=(3,1675) got=(3,1677)
Tree 6 page 1675 cell 0: Bad ptr map entry key=2603 expected=(4,1168) got=(2,0)
Tree 6 page 1670 cell 1: Bad ptr map entry key=1439 expected=(3,1670) got=(3,1675)
Tree 6 page 1670 cell 0: Bad ptr map entry key=2383 expected=(4,1067) got=(4,1439)
Tree 6 page 1664 cell 1: Bad ptr map entry key=1605 expected=(3,1664) got=(3,1670)
Tree 6 page 1661 cell 1: Bad ptr map entry key=1540 expected=(3,1661) got=(3,1664)
Tree 6 page 1659 cell 0: Bad ptr map entry key=1581 expected=(3,1659) got=(3,1661)
Tree 6 page 1253 cell 0: Bad ptr map entry key=1477 expected=(3,1253) got=(3,1659)
Tree 6 page 1655 cell 1: Bad ptr map entry key=1437 expected=(3,1655) got=(3,1253)
Tree 6 page 1655 cell 1: Bad ptr map entry key=1766 expected=(4,1437) got=(4,1605)
Tree 6 page 1653 cell 0: Bad ptr map entry key=1427 expected=(3,1653) got=(3,1655)
Tree 6 page 1651 cell 0: Bad ptr map entry key=1299 expected=(3,1651) got=(3,1653)
Tree 6 page 1699 cell 0: Bad ptr map entry key=1051 expected=(3,1699) got=(3,1651)
Tree 6 page 1649 cell 0: Bad ptr map entry key=1291 expected=(3,1649) got=(3,1699)
Tree 6 page 1646 cell 1: Bad ptr map entry key=1066 expected=(3,1646) got=(3,1649)
Tree 6 page 1646 cell 1: Bad ptr map entry key=1966 expected=(4,1066) got=(4,1388)
Tree 6 page 1639 cell 0: Bad ptr map entry key=1017 expected=(3,1639) got=(3,1646)
Tree 6 page 1637 cell 0: Bad ptr map entry key=1003 expected=(3,1637) got=(3,1639)
Tree 6 page 1635 cell 0: Bad ptr map entry key=1403 expected=(3,1635) got=(3,1637)
Tree 6 page 1633 cell 0: Bad ptr map entry key=1416 expected=(3,1633) got=(3,1635)
Tree 6 page 1630 cell 0: Bad ptr map entry key=1214 expected=(3,1630) got=(3,1633)
Tree 6 page 1626 cell 0: Bad ptr map entry key=1515 expected=(3,1626) got=(3,1630)
Tree 6 page 1626 cell 0: Bad ptr map entry key=1953 expected=(4,1515) got=(4,1017)
Tree 6 page 1623 cell 0: Bad ptr map entry key=1332 expected=(3,1623) got=(3,1626)
Tree 6 page 1621 cell 0: Bad ptr map entry key=1602 expected=(3,1621) got=(3,1623)
Tree 6 page 1619 cell 0: Bad ptr map entry key=1669 expected=(3,1619) got=(3,1621)
Tree 6 page 1617 cell 0: Bad ptr map entry key=1297 expected=(3,1617) got=(3,1619)
Tree 6 page 1614 cell 0: Bad ptr map entry key=1379 expected=(3,1614) got=(3,1617)
Tree 6 page 1611 cell 1: Bad ptr map entry key=1676 expected=(3,1611) got=(3,1614)
Tree 6 page 1609 cell 0: Bad ptr map entry key=1208 expected=(3,1609) got=(3,1611)
Tree 6 page 1606 cell 0: Bad ptr map entry key=1234 expected=(3,1606) got=(3,1609)
Tree 6 page 1603 cell 0: Bad ptr map entry key=1311 expected=(3,1603) got=(3,1606)
Tree 6 page 1601 cell 0: Bad ptr map entry key=1269 expected=(3,1601) got=(3,1603)
Tree 6 page 1599 cell 0: Bad ptr map entry key=1068 expected=(3,1599) got=(3,1601)
Tree 6 page 1599 cell 0: Bad ptr map entry key=1939 expected=(4,1068) got=(4,1332)
Tree 6 page 1597 cell 1: Bad ptr map entry key=1335 expected=(3,1597) got=(3,1599)
Tree 6 page 1434 cell 0: Bad ptr map entry key=1585 expected=(3,1434) got=(3,1597)
Tree 6 page 1592 cell 0: Bad ptr map entry key=1795 expected=(3,1592) got=(3,1434)
Tree 6 page 1590 cell 0: Bad ptr map entry key=1466 expected=(3,1590) got=(3,1592)
Tree 6 page 1590 cell 0: Bad ptr map entry key=1942 expected=(4,1466) got=(4,1585)
Tree 6 page 1586 cell 0: Bad ptr map entry key=1123 expected=(3,1586) got=(3,1590)
Tree 6 page 1583 cell 0: Bad ptr map entry key=1678 expected=(3,1583) got=(3,1586)
Tree 6 page 1854 cell 1: Bad ptr map entry key=1200 expected=(3,1854) got=(3,1583)
Tree 6 page 1854 cell 1: Bad ptr map entry key=1731 expected=(4,1200) got=(4,1123)
Tree 6 page 1579 cell 0: Bad ptr map entry key=1000 expected=(3,1579) got=(3,1854)
Tree 6 page 1572 cell 0: Bad ptr map entry key=1384 expected=(3,1572) got=(3,1579)
Tree 6 page 1572 cell 0: Bad ptr map entry key=1632 expected=(4,1384) got=(4,1000)
Tree 6 page 1552 cell 0: Bad ptr map entry key=1285 expected=(3,1552) got=(3,1572)
Tree 6 page 1568 cell 1: Bad ptr map entry key=1175 expected=(3,1568) got=(3,1552)
Tree 6 page 1565 cell 0: Bad ptr map entry key=1430 expected=(3,1565) got=(3,1568)
Tree 6 page 1565 cell 0: Bad ptr map entry key=2418 expected=(4,1430) got=(2,0)
Tree 6 page 1562 cell 0: Bad ptr map entry key=1112 expected=(3,1562) got=(3,1565)
Tree 6 page 1560 cell 0: Bad ptr map entry key=1877 expected=(3,1560) got=(3,1562)
Tree 6 page 1560 cell 0: Bad ptr map entry key=1995 expected=(4,1877) got=(4,1285)
Tree 6 page 1557 cell 0: Bad ptr map entry key=1571 expected=(3,1557) got=(3,1560)

Next I tried the solution from https://support.storj.io/hc/en-us/articles/360029309111-How-to-fix-a-database-disk-image-is-malformed- which is basically what you wrote before. It again led to a file that I could import, but the app crashes with this error on the first start:

android.database.sqlite.SQLiteException: table Feeds already exists (code 1 SQLITE_ERROR): , while compiling: CREATE TABLE Feeds (id INTEGER PRIMARY KEY AUTOINCREMENT ,title TEXT,custom_title TEXT,file_url TEXT,download_url TEXT,downloaded INTEGER,link TEXT,description TEXT,payment_link TEXT,last_update TEXT,language TEXT,author TEXT,image_url TEXT,type TEXT,feed_identifier TEXT,auto_download INTEGER DEFAULT 1,username TEXT,password TEXT,include_filter TEXT DEFAULT '',exclude_filter TEXT DEFAULT '',minimal_duration_filter INTEGER DEFAULT -1,keep_updated INTEGER DEFAULT 1,is_paged INTEGER DEFAULT 0,next_page_link TEXT,hide TEXT,sort_order TEXT,last_update_failed INTEGER DEFAULT 0,auto_delete_action INTEGER DEFAULT 0,feed_playback_speed REAL DEFAULT -1.0,feed_volume_adaption INTEGER DEFAULT 0,tags TEXT,feed_skip_intro INTEGER DEFAULT 0,feed_skip_ending INTEGER DEFAULT 0,episode_notification INTEGER DEFAULT 0,new_episodes_action INTEGER DEFAULT 0)

@ByteHamster
Copy link
Member

It again led to a file that I could import

Try running that file through my script

@graue70
Copy link

graue70 commented Sep 27, 2023

Try running that file through my script

Error: File not found, not a database, or too corrupted for this script.

By the way: The file I get from the dump has 5.4 MB while the CorruptedDatabaseBackup file has 17,9 MB.

@ByteHamster
Copy link
Member

Could you send me your CorruptedDatabaseBackup via email, please? My address is info@<my username>.com. I will see if I can tweak the script accordingly.

@ByteHamster
Copy link
Member

I added the steps described in #2463 (comment) to my script and tested it with your database. Seems to work.

See https://github.com/ByteHamster/AntennaPodDbFixer for the updated script

@antennapod-bot
Copy link

This issue has been mentioned on AntennaPod Forum. There might be relevant details there:

https://forum.antennapod.org/t/clarification-on-wiped-database-post/5089/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Confirmed bug Bugs confirmed by a lead developer
Projects
None yet
Development

No branches or pull requests