lingochamp / FileDownloader

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

Https下载大文件失败 #757

Open rty1237ricky opened 6 years ago

rty1237ricky commented 6 years ago

你好,最近与后台使用https传输一个大概500M的文件,出现了返回timeout的错误,而后台有打印出客户端已正在下载的日志,我这边使用issues #437的下载地址https://f.qr2c.cn/data/uploads/paper/2016/12/27/5861c2082ac92.zip 能下载成功(文件大小1.27M,还有另外一个80M的https的文件也下载成功), 然后使用android studio的下载地址https://dl.google.com/dl/android/studio/install/2.3.3.0/android-studio-bundle-162.4069837-windows.exe 下载失败(文件大小2.2G),https的证书验证已设置为全部信任。以下是失败的打印日志:

09-07 11:13:33.343 26381-26381/? I/art: Late-enabling -Xcheck:jni 09-07 11:13:33.366 26381-26381/? E/Environment: canonicalPath = /storage/sdcard 09-07 11:13:33.387 26381-26389/? I/art: Debugger is no longer active 09-07 11:13:33.395 26381-26381/? W/ResourcesManager: Asset path '/system/framework/android.test.runner.jar' does not exist or contains no resources. 09-07 11:13:34.708 26381-26381/package:filedownloader D/FileDownloader.FileDownloadProperties: not found filedownloader.properties 09-07 11:13:34.709 26381-26381/package:filedownloader I/FileDownloader.FileDownloadProperties: init properties 38 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 09-07 11:13:34.737 26381-26381/package:filedownloader D/FileDownloader.FileDownloadUtils: can't continue 1017099751 file not suit, exists[FALSE], directory[FALSE] 09-07 11:13:34.738 26381-26381/package:filedownloader D/FileDownloader.FileDownloadUtils: can't continue 1017099751 file not suit, exists[FALSE], directory[FALSE] 09-07 11:13:34.741 26381-26381/package:filedownloader D/FileDownloader.MaintainerIterator: delete 1017099751 09-07 11:13:34.756 26381-26381/package:filedownloader D/FileDownloader.FileDownloadDatabase: refreshed data count: 0 , delete data count: 1, reset id count: 0. consume 22 09-07 11:13:34.809 26381-26396/package:filedownloader D/FileDownloader.FileDownloadManager: request start the task with url(https://dl.google.com/dl/android/studio/install/2.3.3.0/android-studio-bundle-162.4069837-windows.exe) path(/sdcard/temp) isDirectory(FALSE) 09-07 11:13:34.870 26381-26422/package:filedownloader D/FileDownloader.FileDownloadUtils: can't continue 2060627265 file not suit, exists[FALSE], directory[FALSE] 09-07 11:13:34.880 26381-26422/package:filedownloader D/FileDownloader.DownloadMgrInitialParams: initial FileDownloader manager with the customize connection creator: cn.dreamtobe.filedownloader.OkHttp3Connection$Creator@36cf0008 09-07 11:13:34.917 26381-26422/package:filedownloader D/FileDownloader.ConnectTask: 2060627265 request header {range=[bytes=0-]} 09-07 11:13:35.610 26381-26422/package:filedownloader D/FileDownloader.FileDownloadUtils: etag find "14388e" for task(2060627265) 09-07 11:13:35.842 26381-26394/package:filedownloader I/art: Background sticky concurrent mark sweep GC freed 14947(1090KB) AllocSpace objects, 4(64KB) LOS objects, 13% free, 5MB/6MB, paused 6.939ms total 269.176ms 09-07 11:13:35.861 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: fetch data with multiple connection(count: [5]) for task[2060627265] totalLength[2020009280] 09-07 11:13:35.885 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: enable multiple connection: id[2060627265] index[0] range[0, 404001855) current offset(0) 09-07 11:13:35.886 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: enable multiple connection: id[2060627265] index[1] range[404001856, 808003711) current offset(404001856) 09-07 11:13:35.891 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: enable multiple connection: id[2060627265] index[2] range[808003712, 1212005567) current offset(808003712) 09-07 11:13:35.897 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: enable multiple connection: id[2060627265] index[3] range[1212005568, 1616007423) current offset(1212005568) 09-07 11:13:35.903 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: enable multiple connection: id[2060627265] index[4] range[1616007424, 0) current offset(1616007424) 09-07 11:13:35.928 26381-26451/package:filedownloader D/FileDownloader.ConnectTask: 2060627265 request header {range=[bytes=1212005568-1616007423]} 09-07 11:13:35.966 26381-26389/package:filedownloader W/art: Suspending all threads took: 7.576ms 09-07 11:13:35.997 26381-26452/package:filedownloader D/FileDownloader.ConnectTask: 2060627265 request header {range=[bytes=1616007424-]} 09-07 11:13:36.006 26381-26450/package:filedownloader D/FileDownloader.ConnectTask: 2060627265 request header {range=[bytes=808003712-1212005567]} 09-07 11:13:36.011 26381-26448/package:filedownloader D/FileDownloader.ConnectTask: 2060627265 request header {range=[bytes=0-404001855]} 09-07 11:13:36.030 26381-26449/package:filedownloader D/FileDownloader.ConnectTask: 2060627265 request header {range=[bytes=404001856-808003711]} 09-07 11:13:40.854 26381-26393/package:filedownloader I/art: WaitForGcToComplete blocked for 15.118ms for cause HeapTrim 09-07 11:13:40.927 26381-26394/package:filedownloader I/art: Background partial concurrent mark sweep GC freed 23(832B) AllocSpace objects, 0(0B) LOS objects, 21% free, 14MB/18MB, paused 5.325ms total 55.757ms 09-07 11:13:41.849 26381-26451/package:filedownloader D/FileDownloader.DownloadRunnable: the connection[3] for 2060627265, is connected range[1212005568, 1616007423) current offset[1212005568] with code[206] 09-07 11:13:41.876 26381-26451/package:filedownloader D/FileDownloader.FetchDataTask: start fetch(3): range [1212005568, 1616007423), seek to[1212005568] 09-07 11:13:41.914 26381-26451/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[3] offset[1212009664], consume[26] 09-07 11:13:43.221 26381-26449/package:filedownloader D/FileDownloader.DownloadRunnable: the connection[1] for 2060627265, is connected range[404001856, 808003711) current offset[404001856] with code[206] 09-07 11:13:43.232 26381-26449/package:filedownloader D/FileDownloader.FetchDataTask: start fetch(1): range [404001856, 808003711), seek to[404001856] 09-07 11:13:43.291 26381-26449/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[1] offset[404005952], consume[54] 09-07 11:13:43.714 26381-26448/package:filedownloader D/FileDownloader.DownloadRunnable: the connection[0] for 2060627265, is connected range[0, 404001855) current offset[0] with code[206] 09-07 11:13:43.715 26381-26448/package:filedownloader D/FileDownloader.FetchDataTask: start fetch(0): range [0, 404001855), seek to[0] 09-07 11:13:43.753 26381-26450/package:filedownloader D/FileDownloader.DownloadRunnable: the connection[2] for 2060627265, is connected range[808003712, 1212005567) current offset[808003712] with code[206] 09-07 11:13:43.754 26381-26450/package:filedownloader D/FileDownloader.FetchDataTask: start fetch(2): range [808003712, 1212005567), seek to[808003712] 09-07 11:13:43.798 26381-26450/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[2] offset[808007265], consume[41] 09-07 11:13:44.093 26381-26448/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[0] offset[66375], consume[22] 09-07 11:13:44.354 26381-26452/package:filedownloader D/FileDownloader.DownloadRunnable: the connection[4] for 2060627265, is connected range[1616007424, 0) current offset[1616007424] with code[206] 09-07 11:13:44.356 26381-26452/package:filedownloader D/FileDownloader.FetchDataTask: start fetch(4): range [1616007424, 0), seek to[1616007424] 09-07 11:13:44.392 26381-26452/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[4] offset[1616011520], consume[20] 09-07 11:13:45.292 26381-26449/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[1] offset[405419995], consume[53] 09-07 11:13:46.125 26381-26448/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[0] offset[262983], consume[22] 09-07 11:13:47.369 26381-26449/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[1] offset[406626849], consume[101] 09-07 11:13:47.370 26381-26394/package:filedownloader I/art: Background sticky concurrent mark sweep GC freed 4930(1741KB) AllocSpace objects, 0(0B) LOS objects, 9% free, 16MB/18MB, paused 5.555ms total 57.621ms 09-07 11:13:48.147 26381-26448/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[0] offset[667200], consume[43] 09-07 11:13:49.337 26381-26449/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[1] offset[407944512], consume[66] 09-07 11:13:50.878 26381-26448/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[0] offset[1116332], consume[79] 09-07 11:13:51.302 26381-26449/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[1] offset[409303182], consume[27] 09-07 11:13:52.876 26381-26448/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[0] offset[1445355], consume[72] 09-07 11:13:53.320 26381-26449/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[1] offset[410492130], consume[37] 09-07 11:13:53.661 26381-26451/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[3] offset[1212922527], consume[31] 09-07 11:13:53.689 26381-26449/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[1] offset[410806320], consume[10] 09-07 11:13:53.911 26381-26448/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[0] offset[1707499], consume[10] 09-07 11:13:54.415 26381-26452/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[4] offset[1616039647], consume[19] 09-07 11:13:54.416 26381-26452/package:filedownloader D/FileDownloader.DownloadStatusCallback: require callback -1 but the host thread of the flow has already dead, what is occurred because of there are several reason can final this flow on different thread. 09-07 11:13:54.447 26381-26450/package:filedownloader D/FileDownloader.FetchDataTask: require sync id[2060627265] index[2] offset[808040033], consume[9] 09-07 11:13:54.454 26381-26450/package:filedownloader D/FileDownloader.DownloadStatusCallback: require callback -1 but the host thread of the flow has already dead, what is occurred because of there are several reason can final this flow on different thread. 09-07 11:13:54.460 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: finish sub-task for [2060627265] TRUE FALSE 09-07 11:13:54.461 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: finish sub-task for [2060627265] TRUE FALSE 09-07 11:13:54.466 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: finish sub-task for [2060627265] TRUE FALSE 09-07 11:13:54.469 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: finish sub-task for [2060627265] TRUE FALSE 09-07 11:13:54.483 26381-26422/package:filedownloader D/FileDownloader.DownloadLaunchRunnable: finish sub-task for [2060627265] TRUE FALSE 09-07 11:14:04.160 26381-26389/package:filedownloader W/art: Suspending all threads took: 37.507ms

望协助分析,谢谢!

cuihee commented 5 years ago

请问如何设置https的证书为信任的?

rantianhua commented 5 years ago

请问使用的 FileDownloader 版本是多少?

rantianhua commented 4 years ago
D/FileDownloader.DownloadStatusCallback: require callback -1 but the host thread of the flow has already dead, what is occurred because of there are several reason can final this flow on different thread.

这条日志表明在进行进度回调时,回调线程挂掉了。你给的日志是 FileDownloader 进程的日志,从这个日志里看没有发生什么异常,所以很可能是外部调用了 pause 方法。所以需要确认下在你的代码逻辑里是否有哪里出发了暂停?

OpenfaceSY commented 3 years ago

我也遇到了相似的问题,现在过程中,突然就卡住了,也没有报错的信息,请问FileDownloader的日志要怎么获取呢?

我也用试了OkDownload,也是同样的问题,已经困扰三天了!!!