Tobi823 / ffupdater

FFUpdater: Updater for privacy friendly browser
https://f-droid.org/en/packages/de.marmaro.krt.ffupdater
GNU General Public License v3.0
648 stars 32 forks source link

FFUpdater crashes when device is set to airplane mode #74

Closed sanjayen closed 2 years ago

sanjayen commented 3 years ago

I have 'Automatic in Background' enabled for Application Update Check. Every night I put my mobile into airplane mode and when I open notifications in the morning, there is a FFUpdater crash message.

I am using version 74.3.5.

The notification screenshot is attached, the error stacktrace is pasted below.

de.marmaro.krt.ffupdater.app.impl.exceptions.ApiNetworkException: Failed to consume API. Previous exceptions: [Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname; Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname; Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname; Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname; Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname]. at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.readNetworkResourceWithRetries(ApiConsumer.kt:69) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.access$readNetworkResourceWithRetries(ApiConsumer.kt:20) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer$readNetworkResourceWithRetries$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) Caused by: java.net.UnknownHostException: Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156) at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103) at java.net.InetAddress.getAllByName(InetAddress.java:1152) at com.android.okhttp.Dns$1.lookup(Dns.java:41) at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:178) at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:144) at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:86) at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:176) at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128) at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:248) at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211) at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.readNetworkResource(ApiConsumer.kt:80) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.readNetworkResourceWithRetries(ApiConsumer.kt:54) ... 8 more Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname) at libcore.io.Linux.android_getaddrinfo(Native Method) at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:73) at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:202) at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:73) at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135) ... 26 more FFUpdater-background-check-crash-notification

Tobi823 commented 3 years ago

Sry for the late response, I'm busy and I will look into it next weekend.

The background check should only be executed if the internet is accessible. But apparently it doesn't work. (but I suspect it works for many others).

Maybe you are using a VPN? Maybe the app don't pass the information (that you are offline) to the operating system. Which OS are you using? Do you have special network configurations oder root apps?

sanjayen commented 3 years ago

Not a problem Tobi.

I do use AdGuard in the VPN mode and this device is Pixel 4a on Android 11.

I have not rooted this device and hence no root apps.

Tobi823 commented 3 years ago

I suspect that AdGuard (https://f-droid.org/is/packages/com.adguard.android.contentblocker/) does not cause this error. The app doesn't add a system-wide VPN and only modifies the Yandex / Samsung Internet browser.

I think something else (your Android operating system or another app) is causing problems.

As a workaround, I can add a check to run the "background update check" only when airplane mode is disabled. That should fix your problem.

sanjayen commented 3 years ago

Tobi, I use AdGuard for Android using the APK linked from this page;

https://adguard.com/en/adguard-android/overview.html

AdGuard works in VPN mode, so that it can block ads on non-rooted devices.

Also, AdGuard also sells an actual VPN product, which is different from this VPN created locally on the device.

Tobi823 commented 3 years ago

ffupdater-release.zip

Can you check if the problem is fixed now?

Unfortunately I have to compress the APK file as a ZIP because otherwise I can't upload it here directly.

But you have to uninstall the version of F-Droid before, because my APK file is signed differently. (https://github.com/Tobi823/ffupdater#temporary-builds)

sanjayen commented 3 years ago

Tobi - will check later today and let you know.

Will uninstall and install this build.

sanjayen commented 3 years ago

Tobi - I am now using version 74.3.5, as provided in the zip file yesterday.

Did not receive the background check fail notification, when I had kept my mobile on airplane mode throughout the night.

However, I tried to manually put the device into airplane mode and checked for updates. It timed out mentioning a temporary network issue. I then disabled airplane mode and checked, it worked perfectly.

Immediately after this, a background check fail notification appeared with the following stacktrace;

de.marmaro.krt.ffupdater.app.impl.exceptions.ApiNetworkException at ApiConsumer.kt:69 de.marmaro.krt.ffupdater.app.impl.exceptions.ApiNetworkException

de.marmaro.krt.ffupdater.app.impl.exceptions.ApiNetworkException: Failed to consume API. Previous exceptions: [connection closed; Connection reset; Connection reset; Connection reset; Connection reset]. at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.readNetworkResourceWithRetries(ApiConsumer.kt:69) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.access$readNetworkResourceWithRetries(ApiConsumer.kt:20) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer$readNetworkResourceWithRetries$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:215) at java.net.SocketInputStream.read(SocketInputStream.java:144) at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readFromSocket(ConscryptEngineSocket.java:945) at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:909) at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.access$100(ConscryptEngineSocket.java:731) at com.android.org.conscrypt.ConscryptEngineSocket.doHandshake(ConscryptEngineSocket.java:241) at com.android.org.conscrypt.ConscryptEngineSocket.startHandshake(ConscryptEngineSocket.java:220) at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:196) at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:153) at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116) at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186) at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128) at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:248) at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211) at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.readNetworkResource(ApiConsumer.kt:80) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.readNetworkResourceWithRetries(ApiConsumer.kt:54) ... 8 more

Android Version: 30 Device Manufacturer: Google Device Model: Pixel 4a

Tobi823 commented 3 years ago

Can you try this new version? ffupdater-release.zip

I further improve the handling of internet problems in the background update check (instead of failing after 30s when internet is not available, the background check will be delayed exponential when internet is not available [30 seconds, 1 minute, 2m, 4m, ... up to 5 hours])

sanjayen commented 3 years ago

Sure Tobi, will install and revert by tomorrow morning.

Thank you for your dedication in supporting this app.

sanjayen commented 3 years ago

Tobi - the version you shared yesterday - 74.3.6 (79) worked perfectly. No more background check failure notifications.

Closing this ticket. Thank you for your support.

sanjayen commented 3 years ago

Tobi - I downloaded and installed the experimental build 74.4.0 (79) from Gitlab Tags.

My device was on airplane mode all throughout the night. I do not remember opening up FFUpdater to check or test but this is the crash stacktrace.

de.marmaro.krt.ffupdater.app.impl.exceptions.ApiNetworkException

Failed to consume network resource. Previous exceptions: Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname; Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname;

de.marmaro.krt.ffupdater.app.impl.exceptions.ApiNetworkException: Failed to consume network resource. Previous exceptions: Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname; Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname; at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.consumeNetworkResource(ApiConsumer.kt:64) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer$consumeNetworkResource$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) Caused by: java.net.UnknownHostException: Unable to resolve host "firefox-ci-tc.services.mozilla.com": No address associated with hostname at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156) at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103) at java.net.InetAddress.getAllByName(InetAddress.java:1152) at com.android.okhttp.Dns$1.lookup(Dns.java:41) at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:178) at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:144) at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:86) at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:176) at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128) at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:248) at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211) at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.readNetworkResource(ApiConsumer.kt:75) at de.marmaro.krt.ffupdater.app.impl.fetch.ApiConsumer.consumeNetworkResource(ApiConsumer.kt:41) ... 7 more Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname) at libcore.io.Linux.android_getaddrinfo(Native Method) at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:73) at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:202) at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:73) at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135) ... 25 more

Tobi823 commented 3 years ago

My new approach:

If the background update check triggers a "java.net.UnknownHostException" (this is your case):

Even if the background job triggers the java.net.UnknownHostException every time during the night, the additional power consumption for your device is every low (due to the exponential waiting time: 1 execution + 10 retries in 10 hours).

And I think it's safe to ignore this java.net.UnknownHostException in the background update check because:

Tobi823 commented 3 years ago

Should be fixed now - you can try it out ffupdater-release.zip

Tobi823 commented 2 years ago

@sanjayen What DNS server are you using? Maybe these crashes was caused by an fault caused by a DNS server or DNS setting.

Tobi823 commented 2 years ago

@sanjayen Are you using the

sanjayen commented 2 years ago

@Tobi823 here are the answers and to start with the news that FFUpdater no longer crashes if I put it into Airplane mode. Will answer in the other bug about the Cancel issue.

@sanjayen What DNS server are you using? Maybe these crashes was caused by an fault caused by a DNS server or DNS setting.

I use AdGuard's own DNS server over HTTPS. The same can be configured from within the AdGuard app under DNS Filtering.

@sanjayen Are you using the

* default Google Play Services / Google Apps

* microG (privacy friendly replacement for Google Play Services)

* or none from above (de-googled smartphone)

Using a default Google Play Services but with the only change that I have placed the un-installable Google Apps under Pause mode using Digital Wellbeing's Focus mode. These Google apps include;

As this is a Pixel 4a under warranty, I have not rooted the same. Found a way to pause Google apps so that I can try and work without depending on them.

Tobi823 commented 2 years ago

I further improved the handling in 74.4.3.

You can either wait for the offical F-Droid release, install the APK file from GitHub/GitLab or try my personal F-Droid repository (see https://github.com/Tobi823/ffupdater#f-droid-repository).