rethink-app
rethink-app copied to clipboard
[BUG] App data corruption when stopping Rethink for a few hours
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
@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.
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.
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).
Thanks I'll use logcat, i'm more confortable with that rather than sending 500kb of logs
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)
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.
Hello, i sent the logcat when the bug happened, I'm going to try again tomorrow and screen record what's happening as well.
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.
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:
Corrupted:
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.
I'll try again when I can
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?
Hello! Sorry for the inactivity. I forgot about this until this bug re-happened today, after disabling the VPN for an hour or so for localhost functionality. The built-in bug reporter complains that it cannot find any crashes, so I sent an email with the contents of adb logcat 'com.celzero.bravedns:V' '\*:S' (around 20mb) to @ignoramous and @hussainmohd-a
Again, this is fine, I constantly backup the app, but I thought it would be interesting to understand what is going on that could destroy user data with such little input
@TyraVex Thanks for the logs — I’ll review them and get back to you with details. Just one more question regarding the issue: is Rethink installed in the work profile or the primary (personal) profile?
The built-in bug reporter complains that it cannot find any crashes,
There's a bug where the bugreport itself gets corrupted and never recovers. Besides, what you're seeing is unlikely to be a "crash" and the bugreport, which is really only handy for capturing crashes, wouldn't have made much difference.
forgot about this until this bug re-happened today
Seems like your installation is in a state where you hit this fairly frequently. Do you notice any other pattern when this happens? Like the app losing data after rebooting post System/OS Update, for example? Have you, at any point, reinstalled the app? Do you run multiple instances of the app (work & main profile, for example)?
@TyraVex Thanks for the logs — I’ll review them and get back to you with details. Just one more question regarding the issue: is Rethink installed in the work profile or the primary (personal) profile?
Thanks!
It's on my personal phone, there is no work profile. It's heavily debloated and rooted, running the HyperOS 2 custom rom from xiaomi.eu on Android 14.
Seems like your installation is in a state where you hit this fairly frequently. Do you notice any other pattern when this happens? Like the app losing data after rebooting post System/OS Update, for example? Have you, at any point, reinstalled the app? Do you run multiple instances of the app (work & main profile, for example)?
I have used some root-level backup and restore app, but I don't remember if this was before it started crashing or after. Logic says it would be after, but I can't remember exactly.
The only pattern so far I noticed was to disable the VPN between 15 min and more, and sometimes, nothing happens, other times, it breaks. Maybe 30% of the time? I think the more I wait, the more it is likely to break. Regarding boot and updates, I already had the bug after a reboot, but because of the time waited, it seems to not be related. Disabling, rebooting, and activating the VPN directly within 5-10 min never broke the app.