ffupdater icon indicating copy to clipboard operation
ffupdater copied to clipboard

This error is always happen.

Open Seven7zip opened this issue 1 year ago • 4 comments

Stacktrace:

de.marmaro.krt.ffupdater.network.exceptions.NetworkException: File download failed.
	at de.marmaro.krt.ffupdater.network.FileDownloader$downloadFileAsync$2$1.invokeSuspend(Unknown Source:90)
	at t3.a.resumeWith(Unknown Source:8)
	at g4.h0.run(Unknown Source:94)
	at i4.e.run(Unknown Source:11)
	at j4.j.run(Unknown Source:2)
	at j4.a$a.run(SourceFile:9)
Caused by: java.net.SocketTimeoutException: timeout
	at s4.q$c.l(SourceFile:1)
	at s4.q$b.read(SourceFile:20)
	at p4.c$b.read(Unknown Source:15)
	at x4.s.read(SourceFile:4)
	at x4.j.read(Unknown Source:7)
	at de.marmaro.krt.ffupdater.network.ProgressResponseBody$trackTransmittedBytes$1.read(Unknown Source:5)
	at x4.s$a.read(SourceFile:4)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:347)
	at java.io.FilterInputStream.read(FilterInputStream.java:107)
	at u.d.t(Unknown Source:23)
	at de.marmaro.krt.ffupdater.network.FileDownloader.downloadFileInternal(SourceFile:3)
	at de.marmaro.krt.ffupdater.network.FileDownloader.access$downloadFileInternal(Unknown Source:0)
	at de.marmaro.krt.ffupdater.network.FileDownloader$downloadFileInternal$1.invokeSuspend(Unknown Source:12)
	... 5 more

Device information:

Key Value
FFUpdater version 77.1.0 (112) release
Device SM-N986N (c2qksw, c2q, kona)
Manufacturer samsung (samsung)
Supported ABIs arm64-v8a, armeabi-v7a, armeabi
Android version 12 (SDK: 31)
OS 21DJ7C11, dpi, release-keys, 1652669480000

Seven7zip avatar Jul 20 '22 03:07 Seven7zip

I suspect that you had a very slow internet connection - can you try it again with a better/faster internet connection (e.g. different WiFi network, mobile data, ...)?

What app are you trying to download?

Tobi823 avatar Jul 20 '22 11:07 Tobi823

Same problem for me. The download seems to always fail as soon as the screen is locked.

Stacktrace:

de.marmaro.krt.ffupdater.network.exceptions.NetworkException: File download failed.
	at de.marmaro.krt.ffupdater.network.FileDownloader$downloadFileAsync$2$1.invokeSuspend(Unknown Source:90)
	at t3.a.resumeWith(Unknown Source:8)
	at g4.h0.run(Unknown Source:94)
	at i4.e.run(Unknown Source:11)
	at j4.j.run(Unknown Source:2)
	at j4.a$a.run(SourceFile:9)
Caused by: java.net.SocketTimeoutException: timeout
	at s4.q$c.l(SourceFile:1)
	at s4.q$b.read(SourceFile:20)
	at p4.c$b.read(Unknown Source:15)
	at x4.s.read(SourceFile:4)
	at x4.j.read(Unknown Source:7)
	at de.marmaro.krt.ffupdater.network.ProgressResponseBody$trackTransmittedBytes$1.read(Unknown Source:5)
	at x4.s$a.read(SourceFile:4)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:347)
	at java.io.FilterInputStream.read(FilterInputStream.java:107)
	at u.d.t(Unknown Source:23)
	at de.marmaro.krt.ffupdater.network.FileDownloader.downloadFileInternal(SourceFile:3)
	at de.marmaro.krt.ffupdater.network.FileDownloader.access$downloadFileInternal(Unknown Source:0)
	at de.marmaro.krt.ffupdater.network.FileDownloader$downloadFileInternal$1.invokeSuspend(Unknown Source:12)
	... 5 more

Device information:

Key Value
FFUpdater version 77.1.0 (112) release
Device FP4 (FP4eea, FP4, FP4)
Manufacturer Fairphone (Fairphone)
Supported ABIs arm64-v8a, armeabi-v7a, armeabi
Android version 11 (SDK: 30)
OS T2M-54013, android-new, release-keys, 1656387202000

Discostu36 avatar Aug 03 '22 19:08 Discostu36

That's strange - I can't replicate it with my own smartphone.

Can you disable the battery optimization for FFUpdater (https://androidflagship.com/29408-turn-off-battery-optimization-for-individual-apps-on-android/) and try it again?

Tobi823 avatar Aug 04 '22 08:08 Tobi823

It already is. I'll keep an eye on it and try to give you a more detailed report on the steps I did before the error happens.

Discostu36 avatar Aug 04 '22 09:08 Discostu36

I just tried it again. App was downloading browser update in the foreground. I wait until the screen turns off due to inactivity. When I turn on the screen again one second later, download has failed.

Stacktrace:

de.marmaro.krt.ffupdater.network.exceptions.NetworkException: File download failed.
	at de.marmaro.krt.ffupdater.network.FileDownloader$downloadFileAsync$2$1.invokeSuspend(Unknown Source:90)
	at t3.a.resumeWith(Unknown Source:8)
	at g4.h0.run(Unknown Source:94)
	at i4.e.run(Unknown Source:11)
	at j4.j.run(Unknown Source:2)
	at j4.a$a.run(SourceFile:9)
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.readUntilDataAvailable(ConscryptEngineSocket.java:824)
	at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.read(ConscryptEngineSocket.java:797)
	at x4.n.read(Unknown Source:45)
	at x4.d.read(Unknown Source:12)
	at x4.s.read(SourceFile:4)
	at s4.f$e.i(SourceFile:6)
	at s4.p.a(SourceFile:35)
	at s4.f$e.invoke(SourceFile:1)
	at o4.b.a(Unknown Source:2)
	at o4.d.a(SourceFile:3)
	at o4.d$d.run(SourceFile:7)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:923)

Device information:

Key Value
FFUpdater version 77.1.0 (112) release
Device FP4 (FP4eea, FP4, FP4)
Manufacturer Fairphone (Fairphone)
Supported ABIs arm64-v8a, armeabi-v7a, armeabi
Android version 11 (SDK: 30)
OS T2M-NB-SW-T1, android-new, release-keys, 1658477923000

Discostu36 avatar Sep 02 '22 04:09 Discostu36

I suspect that when the display is turned off, Android cuts the network connection to preserve energy. The simple (but not most elegant) solution is too keep the screen on during download in the foreground / in the app (https://developer.android.com/training/scheduling/wakelock). What do you think @Discostu36 @Seven7zip ?

(Using the Android DownloadManager for downloading is not really an option because it does not work reliable on all Android devides. And adding an additional implementation for downloading is wasted time IMHO)

Tobi823 avatar Sep 05 '22 13:09 Tobi823

Shouldn't DownloadManager work on all devices since API level 9?

Alternativeley, how about a WakefulBraodcastReceiver? As far as I understand, it would let the screen turn off but keep CPU etc. awake.

Discostu36 avatar Sep 05 '22 13:09 Discostu36

Shouldn't DownloadManager work on all devices since API level 9?

It should but the implementation varied from one device manufacturer to an other. I already encounter these problems:

  • On some Amazon devices the download manager has not the permission to store the downloaded file inside of context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
  • On LineageOS 18.1, the download manager forgets to add the file suffix .apk to the downloaded file
  • On some phones the download manager refuses to start or resume the download
  • Some people want to block all network traffic to google and block also the download manager.

WakefulBraodcastReceiver is not suitable because I have to migrate the logic to a IntentService and I don't see a way how I can regulary communicate the current download progress to the user interface.

Tobi823 avatar Sep 05 '22 14:09 Tobi823

In that case keeping the screen awake might be the best choice.

Discostu36 avatar Sep 05 '22 15:09 Discostu36