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

Handle database corruption gracefully #1063

Open
ignoramous opened this issue Sep 19, 2023 · 2 comments
Open

Handle database corruption gracefully #1063

ignoramous opened this issue Sep 19, 2023 · 2 comments
Assignees
Labels
bug Something isn't working P0 Priority: 0 (urgent and important)

Comments

@ignoramous
Copy link
Collaborator

ignoramous commented Sep 19, 2023

A user writes,

the app keeps crashing in the work profile (created with insular) when choosing RDNS in the DNS settings view (both when accessed from settings view or from home).

App version v055a from f-droid on Pixel 7a with newest Android 13 update.
Indeed, I tried clearing and installing from within the work profile and also by cloning with the insulation functionality. Nothing works. This only happened ever since I installed the app from the website.

I managed to get it working again on my main profile though. Thankfully.

ConfigureRethinkBasicActivity:

09-19 19:48:07.722 29521 29521 I wm_on_top_resumed_gained_called: [218320605,com.celzero.bravedns.ui.ConfigureRethinkBasicActivity,topStateChangedWhenResumed]
09-19 19:48:07.747 29521 29521 E AndroidRuntime: FATAL EXCEPTION: main          
09-19 19:48:07.747 29521 29521 E AndroidRuntime: Process: com.celzero.bravedns, PID: 29521
09-19 19:48:07.747 29521 29521 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.celzero.bravedns.database.RethinkDnsEndpoint.getUrl()' on a null object reference
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at com.celzero.bravedns.ui.RethinkListFragment$updateMaxSwitchUi$1$1.invokeSuspend(Unknown Source:53)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at com.celzero.bravedns.ui.RethinkListFragment$updateMaxSwitchUi$1$1.invoke(SourceFile:0)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at com.celzero.bravedns.ui.RethinkListFragment$updateMaxSwitchUi$1$1.invoke(SourceFile:0)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at com.celzero.bravedns.ui.RethinkListFragment$ioCtx$2.invokeSuspend(Unknown Source:30)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at kotlinx.coroutines.DispatchedTask.run(Unknown Source:93)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(Unknown Source:3)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(Unknown Source:0)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(Unknown Source:14)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(Unknown Source:28)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:0)
09-19 19:48:07.747 29521 29521 E AndroidRuntime: >--Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@8913867, Dispatchers.Main.immediate]

HomeScreenActivity:

09-19 19:57:26.397  5883  5883 I wm_on_create_called: [21461981,com.celzero.bravedns.ui.HomeScreenActivity,performCreate]
09-19 19:57:26.401  5883  5916 I JobScheduler: app-exit-info job path: /data/user/10/com.celzero.bravedns/files/bugreport//bugreport_0.txt
09-19 19:57:26.401  5883  5916 I JobScheduler: app-exit-info job file: bugreport_0.txt, /data/user/10/com.celzero.bravedns/files/bugreport/bugreport_0.txt
09-19 19:57:26.402  5883  5917 W ROOM    : Unable to read database version.     
09-19 19:57:26.402  5883  5917 W ROOM    : java.io.IOException: Bad database header, unable to read 4 bytes at offset 60
09-19 19:57:26.402  5883  5917 W ROOM    : >at androidx.room.util.DBUtil.readVersion(Unknown Source:55)
09-19 19:57:26.402  5883  5917 W ROOM    : >at androidx.room.SQLiteCopyOpenHelper.verifyDatabaseFile(Unknown Source:73)
09-19 19:57:26.402  5883  5917 W ROOM    : >at androidx.room.SQLiteCopyOpenHelper.getWritableDatabase(Unknown Source:5)
09-19 19:57:26.402  5883  5917 W ROOM    : >at androidx.room.RoomDatabase.inTransaction(Unknown Source:4)
09-19 19:57:26.402  5883  5917 W ROOM    : >at androidx.room.RoomDatabase.assertNotSuspendingTransaction(Unknown Source:0)
09-19 19:57:26.402  5883  5917 W ROOM    : >at com.celzero.bravedns.database.AppInfoDAO_Impl.getAllAppDetails(Unknown Source:11)
09-19 19:57:26.402  5883  5917 W ROOM    : >at com.celzero.bravedns.database.AppInfoRepository.getAppInfo(Unknown Source:2)
09-19 19:57:26.402  5883  5917 W ROOM    : >at com.celzero.bravedns.service.FirewallManager.reloadAppList(Unknown Source:64)
09-19 19:57:26.402  5883  5917 W ROOM    : >at com.celzero.bravedns.database.RefreshDatabase$refreshAppInfoDatabase$4.invokeSuspend(Unknown Source:92)
09-19 19:57:26.402  5883  5917 W ROOM    : >at com.celzero.bravedns.database.RefreshDatabase$refreshAppInfoDatabase$4.invoke(SourceFile:0)
09-19 19:57:26.402  5883  5917 W ROOM    : >at com.celzero.bravedns.database.RefreshDatabase$refreshAppInfoDatabase$4.invoke(SourceFile:0)
09-19 19:57:26.402  5883  5917 W ROOM    : >at com.celzero.bravedns.database.RefreshDatabase$ioCtx$2.invokeSuspend(Unknown Source:30)
09-19 19:57:26.402  5883  5917 W ROOM    : >at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
09-19 19:57:26.402  5883  5917 W ROOM    : >at kotlinx.coroutines.DispatchedTask.run(Unknown Source:93)
09-19 19:57:26.402  5883  5917 W ROOM    : >at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(Unknown Source:3)
09-19 19:57:26.402  5883  5917 W ROOM    : >at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2)
09-19 19:57:26.402  5883  5917 W ROOM    : >at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(Unknown Source:0)
09-19 19:57:26.402  5883  5917 W ROOM    : >at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(Unknown Source:14)
09-19 19:57:26.402  5883  5917 W ROOM    : >at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(Unknown Source:28)
09-19 19:57:26.402  5883  5917 W ROOM    : >at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:0)
09-19 19:57:26.403  5883  5918 I JobScheduler: Data usage updated for all apps at 1695121046401
09-19 19:57:26.405  5883  5901 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=eba8bbe6-5cd5-4ef0-8034-f475355ceb85, tags={ com.celzero.bravedns.scheduler.DataUsageUpdater, ScheduledDataUsageJob } ]
09-19 19:57:26.410  5883  5883 I wm_on_create_called: [38818394,com.celzero.bravedns.ui.WelcomeActivity,performCreate]
@ignoramous ignoramous added bug Something isn't working P0 Priority: 0 (urgent and important) labels Sep 19, 2023
@ignoramous
Copy link
Collaborator Author

ignoramous commented Sep 19, 2023

more logs:

09-19 19:56:52.490  5696  5729 E SQLiteLog: (1) no such table: tempDb.DNSLogs in "SELECT * FROM tempDb.DNSLogs LIMIT 1"
09-19 19:56:52.496  5696  5696 I wm_on_create_called: [61846291,com.celzero.bravedns.ui.HomeScreenActivity,performCreate]
09-19 19:56:52.502  5696  5729 I JobScheduler: app-exit-info job path: /data/user/10/com.celzero.bravedns/files/bugreport//bugreport_0.txt
09-19 19:56:52.502  5696  5729 I JobScheduler: app-exit-info job file: bugreport_0.txt, /data/user/10/com.celzero.bravedns/files/bugreport/bugreport_0.txt
09-19 19:56:52.502  5696  5731 I JobScheduler: Data usage updated for all apps at 1695121012501
09-19 19:56:52.503  5696  5730 W ROOM    : Unable to read database version.
09-19 19:56:52.503  5696  5730 W ROOM    : java.io.IOException: Bad database header, unable to read 4 bytes at offset 60
09-19 19:56:52.503  5696  5730 W ROOM    : 	at androidx.room.util.DBUtil.readVersion(Unknown Source:55)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at androidx.room.SQLiteCopyOpenHelper.verifyDatabaseFile(Unknown Source:73)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at androidx.room.SQLiteCopyOpenHelper.getWritableDatabase(Unknown Source:5)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at androidx.room.RoomDatabase.inTransaction(Unknown Source:4)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at androidx.room.RoomDatabase.assertNotSuspendingTransaction(Unknown Source:0)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at com.celzero.bravedns.database.AppInfoDAO_Impl.getAllAppDetails(Unknown Source:11)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at com.celzero.bravedns.database.AppInfoRepository.getAppInfo(Unknown Source:2)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager.reloadAppList(Unknown Source:64)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at com.celzero.bravedns.database.RefreshDatabase$refreshAppInfoDatabase$4.invokeSuspend(Unknown Source:92)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at com.celzero.bravedns.database.RefreshDatabase$refreshAppInfoDatabase$4.invoke(SourceFile:0)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at com.celzero.bravedns.database.RefreshDatabase$refreshAppInfoDatabase$4.invoke(SourceFile:0)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at com.celzero.bravedns.database.RefreshDatabase$ioCtx$2.invokeSuspend(Unknown Source:30)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:93)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(Unknown Source:3)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(Unknown Source:0)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(Unknown Source:14)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(Unknown Source:28)
09-19 19:56:52.503  5696  5730 W ROOM    : 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:0)
09-19 19:56:52.503  5696  5734 W ROOM    : Unable to read database version.
09-19 19:56:52.503  5696  5734 W ROOM    : java.io.IOException: Bad database header, unable to read 4 bytes at offset 60
09-19 19:56:52.503  5696  5734 W ROOM    : 	at androidx.room.util.DBUtil.readVersion(Unknown Source:55)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at androidx.room.SQLiteCopyOpenHelper.verifyDatabaseFile(Unknown Source:73)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at androidx.room.SQLiteCopyOpenHelper.getWritableDatabase(Unknown Source:5)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at androidx.room.RoomDatabase.inTransaction(Unknown Source:4)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at androidx.room.RoomDatabase.assertNotSuspendingTransaction(Unknown Source:0)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.database.AppInfoDAO_Impl.getAllAppDetails(Unknown Source:11)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.database.AppInfoRepository.getAppInfo(Unknown Source:2)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager.reloadAppList(Unknown Source:64)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager$loadAppFirewallRules$2.invokeSuspend(Unknown Source:30)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager$loadAppFirewallRules$2.invoke(SourceFile:0)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager$loadAppFirewallRules$2.invoke(SourceFile:0)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Unknown Source:7)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Unknown Source:53)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:0)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager.loadAppFirewallRules(Unknown Source:17)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager$1.invokeSuspend(Unknown Source:30)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager$1.invoke(SourceFile:0)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager$1.invoke(SourceFile:0)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at com.celzero.bravedns.service.FirewallManager$io$1.invokeSuspend(Unknown Source:30)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:93)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(Unknown Source:3)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(Unknown Source:0)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(Unknown Source:14)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(Unknown Source:28)
09-19 19:56:52.503  5696  5734 W ROOM    : 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:0)
09-19 19:56:52.503  5696  5711 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=6c4a2de6-676d-41ec-9cc9-6c155c3a8db4, tags={ com.celzero.bravedns.scheduler.DataUsageUpdater, ScheduledDataUsageJob } ]
09-19 19:56:52.509  5696  5696 I wm_on_create_called: [263430064,com.celzero.bravedns.ui.WelcomeActivity,performCreate]

@ignoramous
Copy link
Collaborator Author

ignoramous commented Sep 21, 2023

User reported they worked around this crash (which would happen across reinstall / clear data too, but they're on work profile or have work profile enabled; #150):

Btw. I managed to work around the crash bug.

  1. Delete all data and restart app

  2. Restore a previous backup

  3. Press the reload button in the DNS view (on the top right)

  4. Check and enter Rethink DNS settings

  5. Change from Max to Sky or vice versa

  6. Check and update filter lists (on the top right)

Now you should be able to edit Rethink Plus again and everything should be working as usual.

My guess is that both profiles do share some kind of data. A data base or something.
By reinstalling etc a part of the data gets corrupted. Maybe it would be possible to just separate the DB for each profile (use the users data folder instead of the apps data folder) or something like that...

Anyway, I have been using Rethink DNS for over 2 years, I think and there was seldom trouble because of using two instances (work and main profile), so you could almost consider it running stable like that. Maybe it's worth to try and officially support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 Priority: 0 (urgent and important)
Projects
None yet
Development

No branches or pull requests

2 participants