rethink-app
rethink-app copied to clipboard
RethinkDNS crashes when i press "Start"
When i press the button "Start" RethinkDNS crashes. I downloaded the app from f-droid and on my phone i am using LineageOS 17.
Related experience.
RethinkDNS: v053i Device: Samsung M20g. Official ROM.
It crash when;
- After restart and RethinkDNS was running.
- After restart, RethinkDNS was running and other app (like pDNSf) grab VPN line 1st. I do play with some Blocker apps and occasionally forgot about autostart.
- On random time. RethinkDNS will block network 1st, DNS fail I believe. I suspect happen when Network choked. I can't monitor it as it usually happen when device idle for long time. Pressing Stop then Start again will crash RethinkDNS.
If I press "Stop" and then press "Start", it crashes. Then if I open the app again and press "Start" again, it works. Quite strange.
Fairphone 4. Stock Android 11.
Would you know how to grab and share logs via adb logcat
/ bugreport
? If so, grab 'em immediately following the crash, email it to mz @ celzero dot com
Sent!
Fixed in https://github.com/celzero/rethink-app/pull/525
Releasing in a day or two.
@ignoramous Sadly, this seems to still be happening for me. Do you need another logcat? If so I can email you again.
@ignoramous Sadly, this seems to still be happening for me. Do you need another logcat? If so I can email you again.
On v053j
?
@ignoramous Yes sir. The F-Droid version is what I'm using.
So, when you tap on START, the app crashes, and right after the crash, START works, yeah?
You see this behaviour every other time you attempt to START Rethink?
Can you please email the logs you capture just after the crash happens to mz at celzero dot com
?
I've sent you another email! Here's a video for how to reproduce it. It happens near 10/10 times.
In the video I start, stop, start almost right after one another, but this happens even if you start, leave the app for hours, stop, leave the app for hours, start.
https://user-images.githubusercontent.com/12563436/190452872-d1876787-8f98-4b17-a814-f477d26eb478.mp4
Same behavior here
Start = ok Stop = ok Restart = crash
^ everytime
Android 10, huawei
I've sent you another email! Here's a video for how to reproduce it. It happens near 10/10 times.
Thanks. The logs say:
09-15 15:27:56.975 13508 13508 E AndroidRuntime: Process: com.celzero.bravedns, PID: 13508
09-15 15:27:56.975 13508 13508 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{a90cab5 u0 com.celzero.bravedns/.service.BraveVPNService}
09-15 15:27:56.975 13508 13508 E AndroidRuntime: >--at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2006)
09-15 15:27:56.975 13508 13508 E AndroidRuntime: >--at android.os.Handler.dispatchMessage(Handler.java:106)
09-15 15:27:56.975 13508 13508 E AndroidRuntime: >--at android.os.Looper.loop(Looper.java:223)
09-15 15:27:56.975 13508 13508 E AndroidRuntime: >--at android.app.ActivityThread.main(ActivityThread.java:7715)
09-15 15:27:56.975 13508 13508 E AndroidRuntime: >--at java.lang.reflect.Method.invoke(Native Method)
09-15 15:27:56.975 13508 13508 E AndroidRuntime: >--at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
09-15 15:27:56.975 13508 13508 E AndroidRuntime: >--at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
And just prior I see one after the other shared-preference triggers for enabled
(vpn-enabled set to true
), which causes the vpn to "restart" over and over again?
I think we are missing return
statement after signalStopService()
calls here (and possibly add Log.w
too:
https://github.com/celzero/rethink-app/blob/adf8b89f65570ebce92c95e3804e61d058b86b52/app/src/main/java/com/celzero/bravedns/service/BraveVPNService.kt#L1174
https://github.com/celzero/rethink-app/blob/adf8b89f65570ebce92c95e3804e61d058b86b52/app/src/main/java/com/celzero/bravedns/service/BraveVPNService.kt#L1385
https://github.com/celzero/rethink-app/blob/adf8b89f65570ebce92c95e3804e61d058b86b52/app/src/main/java/com/celzero/bravedns/service/BraveVPNService.kt#L1402
This crash is 100% reproducible if there is at least one app that's excluded from the VPN. The reason was there was race between BraveVpnService#restartVpn
(invoked by excludeApps
LiveData change observer init'd in BraveVpnService#onCreate
) and BraveVpnService#onStartCommand
(invoked by VpnController#start
in response to user action) trying to do different things.
restartVpn
sees persistentState#isVpnEnabled
is false
before onStartCommand
can set it to true
and so, restartVpn
tries to signalStopService
whereas onStartCommand
is trying to start it, causing mayhem.
The fix is multi-fold:
- Observe interesting LiveData changes after a new Vpn is created.
- Set
persistentState#vpnEnabled(true)
beforeupdateTun
orrestartVpn
is invoked fromonStartCommand
. - Call
startForeground
fromonStartCommand
as quickly as appropriate. - After calling
signalStopService
fromupdateTun
andrestartVpn
, return back to the caller, instead of proceeding as usual.
The fix will be in the next release v053j
. Thanks for everyone who sent the logs and videos along!
The fix will be in the next release v053j.
053j is the latest fdroid release. Do you mean v053k?
Yeah, v053k
;)
Yeah,
v053k
;)
Can confirm fixed on fdroid v053k
Crashed with v054c
[F-Droid], while updating from previous version.
logs
FATAL EXCEPTION: main
Process: com.celzero.bravedns, PID: 26480
android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1771)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6518)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Hi @shuvashish76: I am not able to reproduce the crash. Are you seeing this 100% of the time? If so, how are you reproducing this bug?
Are you seeing this 100% of the time?
1time crash only. Tried to reproduce the crash but no results.
Thanks. So it is unrelated to this bug (which happened 100% of the time when at least one app was excluded). I'll create a new bug if we get more reports of it to look into that code a bit more.