lingochamp / FileDownloader

Multitask、MultiThread(MultiConnection)、Breakpoint-resume、High-concurrency、Simple to use、Single/NotSingle-process
Apache License 2.0
11.02k stars 2.19k forks source link

require range[0-) with contentLength(2281)错误导致的下载失败 #1133

Open gitByteFlow opened 5 years ago

gitByteFlow commented 5 years ago

下载失败:服务器返回文件大小没有问题

报错如下

taskqueue erro: require range[0-) with contentLength(2281), but the backend response contentLength is 4845656 on downloadId[-1215868937]-connectionIndex[-1], please ask your backend dev to fix such problem.

rantianhua commented 5 years ago

从日志来看,第一次 trail connection 获取到的文件大小为 4845656 ,但是在下载时,返回的大小又变成了 2281 ,所以抛出了这个错误。

rantianhua commented 5 years ago

最好能提供一个完成的下载日志,这样能更准确确定问题。

weituotian commented 5 years ago

@rantianhua 如何找下载日志?

rantianhua commented 5 years ago

在 issue 模板里就有说明:

Before Issue

  1. Please search on the Issues
  2. Please search on the wiki
  3. Please set FileDownloadLog.NEED_LOG=true and review the Logcat output from main process and :filedownloader process ( pay attention to Warn and Error level logcat)

打开日志开关后,过滤 FileDownloader 就能获取到所有 FileDownloader 日志。为了更好的可视化,你还可以用 https://github.com/Jacksgong/okcat 获取日志。

jing-li-rocos commented 4 years ago

I have the similar problem. I have attached the logs here

D/FileDownloader.DownloadTask: setPath /storage/sdcard/io.rocos.agent.android.debug/apks/Rocos Android Agent_1.5.0.apk
D/FileDownloader.DownloadTask: setListener com.cretin.www.cretinautoupdatelibrary.utils.AppUpdateUtils$1@1ea7dacd
V/FileDownloader.DownloadTaskHunter: call start Url[https://jingdevtestrgdiag.blob.core.windows.net/release/rocos-android-agent/app-release-1.5.apk], Path[/storage/sdcard/io.rocos.agent.android.debug/apks/Rocos Android Agent_1.5.0.apk] Listener[com.cretin.www.cretinautoupdatelibrary.utils.AppUpdateUtils$1@1ea7dacd], Tag[null]
V/FileDownloader.DownloadTaskHunter: the task[432216184] has been into the launch pool.
V/FileDownloader.FileDownloadEventPool: setListener event.service.connect.changed
D/FileDownloader.FileDownloadProperties: not found filedownloader.properties
I/FileDownloader.FileDownloadProperties: init properties 0
     load properties: http.lenient=FALSE; process.non-separate=FALSE; download.min-progress-step=65536; download.min-progress-time=2000; download.max-network-thread-count=3; file.non-pre-allocation=FALSE; broadcast.completed=FALSE; download.trial-connection-head-method=FALSE
D/FileDownloader.LostServiceConnectedHandler: Waiting for connecting with the downloader service... 432216184
D/FileDownloader.FileDownloadServiceUIGuard: bindStartByContext RocosAndroidAgentApp
D/FileDownloader.DownloadTaskHunter: free the task 432216184, when the status is 10
D/FileDownloader.FileDownloadServiceUIGuard: onServiceConnected ComponentInfo{io.rocos.agent.android.debug/com.liulishuo.filedownloader.services.FileDownloadService$SeparateProcessService} com.liulishuo.filedownloader.i.IFileDownloadIPCService$Stub$Proxy@8e54990
V/FileDownloader.FileDownloadEventPool: asyncPublishInNewThread event.service.connect.changed
V/FileDownloader.FileDownloadEventPool: publish event.service.connect.changed
D/FileDownloader.LostServiceConnectedHandler: The downloader service is connected.
V/FileDownloader.DownloadTaskHunter: call start Url[https://jingdevtestrgdiag.blob.core.windows.net/release/rocos-android-agent/app-release-1.5.apk], Path[/storage/sdcard/io.rocos.agent.android.debug/apks/Rocos Android Agent_1.5.0.apk] Listener[com.cretin.www.cretinautoupdatelibrary.utils.AppUpdateUtils$1@1ea7dacd], Tag[null]
    the task[432216184] has been into the launch pool.
D/FileDownloader.FileDownloadMessenger: notify begin 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@2ea59d4a by 11 
V/FileDownloader.FileDownloadList: add list in all 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5 11 1
D/FileDownloader.MessageSnapshotGate: ~~~callback 432216184 old[11] new[1] 1
D/FileDownloader.FileDownloadMessenger: notify pending 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback 432216184 old[1] new[6] 1
D/FileDownloader.FileDownloadMessenger: notify started 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback 432216184 old[6] new[2] 1
D/FileDownloader.FileDownloadMessenger: notify connected 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback 432216184 old[2] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5 13885 8292401
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback 432216184 old[3] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5 124477 8292401
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback 432216184 old[3] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5 239165 8292401
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback 432216184 old[3] new[3] 1
D/FileDownloader.FileDownloadMessenger: notify progress 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5 326772 8292401
D/FileDownloader.MessageSnapshotGate: updateKeepFlow
D/FileDownloader.MessageSnapshotGate: ~~~callback 432216184 old[3] new[-1] 1
V/FileDownloader.FileDownloadList: remove 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5 left -1 0
D/FileDownloader.FileDownloadMessenger: notify error 432216184@com.liulishuo.filedownloader.DownloadTask@21aba2b5 com.liulishuo.filedownloader.exception.FileDownloadGiveUpRetryException: require range[5528266-) with contentLength(2764135), but the backend response contentLength is 8292401 on downloadId[432216184]-connectionIndex[2], please ask your backend dev to fix such problem.
V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:over com.liulishuo.filedownloader.DownloadTaskHunter@2ea59d4a by -1 
D/FileDownloader.MessageSnapshotGate: updateKeepFlow

E/【AppUpdateUtils】: 文件开始下载
E/【AppUpdateUtils】: 文件正在下载中,进度为0%
E/【AppUpdateUtils】: 文件正在下载中,进度为1%
E/【AppUpdateUtils】: 文件正在下载中,进度为2%
E/【AppUpdateUtils】: 文件正在下载中,进度为3%
E/【AppUpdateUtils】: 文件下载出错,异常信息为:require range[5528266-) with contentLength(2764135), but the backend response contentLength is 8292401 on downloadId[432216184]-connectionIndex[2], please ask your backend dev to fix such problem.