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

[BUG] App data corruption when stopping Rethink for a few hours #1801

Open
TyraVex opened this issue Nov 24, 2024 · 10 comments
Open

[BUG] App data corruption when stopping Rethink for a few hours #1801

TyraVex opened this issue Nov 24, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@TyraVex
Copy link

TyraVex commented Nov 24, 2024

Hello,

I have been using this app for now over a year, and it has been very useful. Thanks a lot for devs of this project.

Sadly, there is a bug that corrupts a large portion of the app data (I can't open DNS tab, per app rules are 90% gone, proxy configuration is gone, and 90% of app internet access rules are gone).

I lived well with this bug by using backups each time I needed to stop rethink, and restored them upon reusing it. Even so, the proxy config did not come back, but it wasn't a pain to import a wireguard config files and selecting the routed apps.

Today I got the app data corruption bug described above, but I erased my backups by mistake, so I am now finally taking the time to report it.

I am using HyperOS 1.0.5.0 from xiaomi.eu on a Mi 11 Ultra, Android 14. Phone is rooted with magisk.
I'd like to add that this bug happens 100% of the time if the following steps are followed on my device.

To reproduce the bug:

  • Use Rethink on a daily basis with VPN always on mode and blocking requests without VPN (from Android settings)
  • Stop Rethink and disable the Android options above.
  • Wait a few hours
  • Turn rethink back on, data is corrupted. No need to touch Android settings

Things I tried:

  • Using an older phone - Mi 9T Pro, MIUI 12.5, A11, Magisk root - I was unable to reproduce the bug
  • Using latest version from F-Droid
  • Delete app data and reconfigure from scratch
  • Looking at similar github issues
@hussainmohd-a hussainmohd-a self-assigned this Nov 24, 2024
@hussainmohd-a hussainmohd-a added the bug Something isn't working label Nov 24, 2024
@hussainmohd-a
Copy link
Collaborator

@TyraVex, Thanks for the kind words! Could you please share the logs? You can find them in About -> Bug Report (email crash logs)`. This will help us figure out what's causing the issue on your device.

@TyraVex
Copy link
Author

TyraVex commented Nov 24, 2024

Thank you for your response.

Proton Mail is having a hard time processing the email request from Rethink (Proton's fault?)
How can I reach you? I'd prefer to share those logs privately.

@ignoramous
Copy link
Collaborator

Send them to mz at celzero dot com (which is me) or md at celzero dot com (which is @hussainmohd-a).

If you're technical enough, take logs the second time you open the app (when you notice that most of the data is gone) via adb logcat (instead of relying on app's built-in bugreporter which may or may not capture all logs. If you can't, the in-app bugreport would also so. No pressure).

@TyraVex
Copy link
Author

TyraVex commented Nov 25, 2024

Thanks
I'll use logcat, i'm more confortable with that rather than sending 500kb of logs

@TyraVex
Copy link
Author

TyraVex commented Nov 27, 2024

Hello,
I stopped Rethink this night and reenabled it this morning. App data got corrupted. Here's a sample of the log I sent by email:

11-27 08:41:20.293 E/VpnLifecycle(25980): Failure while retrieving Settings.Secure value Settings key: <always_on_vpn_app> is not readable. From S+, settings keys annotated with @hide are restricted to system_server and system apps only, unless they are annotated with @Readable.
11-27 08:41:20.293 E/VpnLifecycle(25980): java.lang.SecurityException: Settings key: <always_on_vpn_app> is not readable. From S+, settings keys annotated with @hide are restricted to system_server and system apps only, unless they are annotated with @Readable.
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.provider.Settings$NameValueCache.getStringForUser(Unknown Source:219)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.provider.Settings$Secure.getStringForUser(Unknown Source:122)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.provider.Settings$Secure.getString(Unknown Source:4)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.celzero.bravedns.util.Utilities.isOtherVpnHasAlwaysOn(Unknown Source:12)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.celzero.bravedns.ui.fragment.HomeScreenFragment.handleAlwaysOnVpn(Unknown Source:11)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.celzero.bravedns.ui.fragment.HomeScreenFragment.handleVpnActivation(Unknown Source:0)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.celzero.bravedns.ui.fragment.HomeScreenFragment.handleMainScreenBtnClickEvent(Unknown Source:75)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.celzero.bravedns.ui.fragment.HomeScreenFragment.initializeClickListeners$lambda$6(Unknown Source:5)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.celzero.bravedns.ui.fragment.HomeScreenFragment.$r8$lambda$eK6GuIQ7-vSriQ9fg_3l7qkR2Dk(SourceFile:0)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.celzero.bravedns.ui.fragment.HomeScreenFragment$$ExternalSyntheticLambda13.onClick(SourceFile:0)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.view.View.performClick(Unknown Source:17)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.view.View.performClickInternal(Unknown Source:3)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.view.View$PerformClick.run(Unknown Source:8)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.os.Handler.handleCallback(Unknown Source:2)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.os.Handler.dispatchMessage(Unknown Source:4)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.os.Looper.loopOnce(Unknown Source:198)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.os.Looper.loop(Unknown Source:83)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at android.app.ActivityThread.main(Unknown Source:123)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at java.lang.reflect.Method.invoke(Native Method)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
11-27 08:41:20.293 E/VpnLifecycle(25980): 	at com.android.internal.os.ZygoteInit.main(Unknown Source:378)

@hussainmohd-a
Copy link
Collaborator

Hi @TyraVex,

Thank you for reporting this issue and providing the detailed steps to reproduce it. Based on the logs you shared, we couldn’t find any errors directly indicating data corruption. The mentioned error appears to be handled gracefully, and the logs being printed don’t seem to point to a critical problem.

Could you clarify what you mean by "data corruption"? For example:

  • Are settings or rules disappearing?
  • Are logs missing, or is it both?
  • Are there any signs of a settings reset?

It would also be helpful if you could share logs from the following scenarios:

  • When you turn off Rethink and adjust the related Android settings.
  • When you turn Rethink back on, leading to the issue.

This additional context will help us investigate the problem more thoroughly.

@TyraVex
Copy link
Author

TyraVex commented Dec 6, 2024

Hello, i sent the logcat when the bug happened, I'm going to try again tomorrow and screen record what's happening as well.

@ignoramous
Copy link
Collaborator

ignoramous commented Dec 6, 2024

Hi, @hussainmohd-a did take a look at it (though he hasn't updated that here). Unfortunately, the logs you sent lacked any noticable errors or warnings for us to conclude anything from it.

Make sure to increase the logcat buffer size (16mb is the max on some devices) before you capture the logs:

adb logcat -G 16m

Optionally, you can also opt to set Rethink in Verbose logging level from Configure -> Settings -> Log level.

@TyraVex
Copy link
Author

TyraVex commented Dec 9, 2024

I'm having a hard time capturing high quality logs using sudo logcat -d -b all | grep com.celzero.bravedns > /sdcard/Download/logs.txt. The -G option doesn't work at all for me.

Here's a screenshot before and after the event (do not look at the clock, I restored the app using root backups after the data corruption happened)

Normal:
Screenshot_2024-12-09-10-54-29-608_com celzero bravedns-edit

Corrupted:
Screenshot_2024-12-09-10-38-46-789_com celzero bravedns-edit

Here are the logs according to the command provided above. It starts at 4am, ends at 10:41am, with me reopening the app witg corrupted data for the first timr at 10:39-41. I don't know why it's so small though.

logs.txt

I'll try again when I can

@ignoramous
Copy link
Collaborator

Thanks.

The grep is probably filtering out way too much. To filter by package, you probably want to adb logcat com.celzero.bravedns:V *:S instead?

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

3 participants