lingochamp / okdownload

A Reliable, Flexible, Fast and Powerful download engine.
Apache License 2.0
5.13k stars 767 forks source link

Android10下载失败,貌似下载区块计算错误导致的。 #464

Open Bter opened 2 years ago

Bter commented 2 years ago

OkDownload Version

v1.0.7

Android Version

V29(Android10)

Problem Describe

Android10每次下载一个新的文件都失败,只有第二次下载,即重新调用DownloadTask.execute(),才可以完成下载; 一样的代码,但Android8好像不会有这样的问题。

Log

2021-08-31 14:35:02.471 17689-17989 D/Util: Get final download store is com.liulishuo.okdownload.core.breakpoint.RemitStoreOnSQLite@e6f0dad 2021-08-31 14:35:02.471 17689-17989 D/OkDownload: downloadStore[com.liulishuo.okdownload.core.breakpoint.BreakpointStoreOnSQLite@c41b8e2] connectionFactory[com.liulishuo.okdownload.core.connection.DownloadOkHttp3Connection$Factory@f1cc473 2021-08-31 14:35:02.485 17689-17989 D/DownloadDispatcher: enqueueLocked for single task: com.liulishuo.okdownload.DownloadTask@f6ac7486@1@https://www.nyzhishan.com/static_2021/d/2.7.6/fotiaoqiang-2.7.6-1-Setup.exe@/storage/emulated/0/Android/data/app/files/ 2021-08-31 14:35:02.491 17689-17989 D/DownloadDispatcher: cancel manually: 1 2021-08-31 14:35:02.492 17689-17989 D/DownloadDispatcher: handle cancel calls, cancel calls: 1 2021-08-31 14:35:02.492 17689-17989 D/DownloadDispatcher: flying canceled: 1 2021-08-31 14:35:02.492 17689-17989 D/DownloadCall: interrupt thread with cancel operation because of chains are not running 1 2021-08-31 14:35:02.492 17689-17989 D/DownloadCall: cancel task 1 consume: 0ms 2021-08-31 14:35:02.492 17689-17989 D/DownloadDispatcher: handle cancel calls, callback cancel event: 1 2021-08-31 14:35:02.492 17689-17993 D/CallbackDispatcher: taskStart: 1 2021-08-31 14:35:02.493 17689-17993 D/DownloadCall: call is finished 1 2021-08-31 14:35:02.494 17689-17989 D/DownloadDispatcher: execute: com.liulishuo.okdownload.DownloadTask@f6ac7486@1@https://www.nyzhishan.com/static_2021/d/2.7.6/fotiaoqiang-2.7.6-1-Setup.exe@/storage/emulated/0/Android/data/app/files/ 2021-08-31 14:35:02.494 17689-17989 D/CallbackDispatcher: taskStart: 1 2021-08-31 14:35:02.507 17689-17989 D/CallbackDispatcher: -----> start trial task(1) {range=[bytes=0-0]} 2021-08-31 14:35:02.849 17689-17989 D/ConnectTrial: task[1] redirect location: null #################文件大小:9512939byte###################### 2021-08-31 14:35:02.851 17689-17989 D/CallbackDispatcher: <----- finish trial task(1) code[206]{accept-ranges=[bytes], content-length=[1], content-range=[bytes 0-0/9512939], content-type=[application/vnd.android.package-archive], date=[Tue, 31 Aug 2021 06:35:02 GMT], last-modified=[Tue, 31 Aug 2021 05:24:23 GMT]} ######################################## 2021-08-31 14:35:02.852 17689-17989 D/DownloadDispatcher: is file conflict after run: 1 2021-08-31 14:35:02.854 17689-17989 D/DownloadCall: breakpoint invalid: download from beginning because of local check is dirty 1 fileExist[false] infoRight[false] outputStreamSupport[true] com.liulishuo.okdownload.core.download.BreakpointLocalCheck@7b14565 2021-08-31 14:35:02.856 17689-17989 D/CallbackDispatcher: downloadFromBeginning: 1 2021-08-31 14:35:02.865 17689-17995 D/DownloadChain: create connection on url: https://www.nyzhishan.com/static_2021/d/2.7.6/fotiaoqiang-2.7.6-1-Setup.exe 2021-08-31 14:35:02.865 17689-17997 D/DownloadChain: create connection on url: https://www.nyzhishan.com/static_2021/d/2.7.6/fotiaoqiang-2.7.6-1-Setup.exe 2021-08-31 14:35:02.865 17689-17996 D/DownloadChain: create connection on url: https://www.nyzhishan.com/static_2021/d/2.7.6/fotiaoqiang-2.7.6-1-Setup.exe 2021-08-31 14:35:02.867 17689-17996 D/HeaderInterceptor: AssembleHeaderRange (1) block(1) downloadFrom(3170981) currentOffset(0) 2021-08-31 14:35:02.867 17689-17995 D/HeaderInterceptor: AssembleHeaderRange (1) block(0) downloadFrom(0) currentOffset(0) 2021-08-31 14:35:02.867 17689-17996 D/CallbackDispatcher: -----> start connection task(1) block(1) {user-agent=[OkDownload/1.0.7], range=[bytes=3170981-6341959]} 2021-08-31 14:35:02.867 17689-17995 D/CallbackDispatcher: -----> start connection task(1) block(0) {user-agent=[OkDownload/1.0.7], range=[bytes=0-3170980]} 2021-08-31 14:35:02.867 17689-17997 D/HeaderInterceptor: AssembleHeaderRange (1) block(2) downloadFrom(6341960) currentOffset(0) #########################第3个(即最后一个)下载区块范围:6341960-9512938?不是6341960-9512939?########################### 2021-08-31 14:35:02.868 17689-17997 D/CallbackDispatcher: -----> start connection task(1) block(2) {user-agent=[OkDownload/1.0.7], range=[bytes=6341960-9512938]} #################################################### 2021-08-31 14:35:02.884 17689-17995 D/CallbackDispatcher: <----- finish connection task(1) block(0) code[206]{accept-ranges=[bytes], content-length=[3170981], content-range=[bytes 0-3170980/9512939], content-type=[application/vnd.android.package-archive], date=[Tue, 31 Aug 2021 06:35:02 GMT], last-modified=[Tue, 31 Aug 2021 05:24:23 GMT]} 2021-08-31 14:35:02.885 17689-17995 D/CallbackDispatcher: fetchStart: 1 2021-08-31 14:35:02.888 17689-17995 D/MultiPointOutputStream: Create new file: USB TPMS_V1.23_1630387463000.apk 2021-08-31 14:35:02.891 17689-17996 D/CallbackDispatcher: <----- finish connection task(1) block(1) code[206]{accept-ranges=[bytes], content-length=[3170979], content-range=[bytes 3170981-6341959/9512939], content-type=[application/vnd.android.package-archive], date=[Tue, 31 Aug 2021 06:35:02 GMT], last-modified=[Tue, 31 Aug 2021 05:24:23 GMT]} 2021-08-31 14:35:02.892 17689-17996 D/CallbackDispatcher: fetchStart: 1 2021-08-31 14:35:02.895 17689-17995 W/DownloadUriOutputStream: fallocate() not supported; falling back to ftruncate() 2021-08-31 14:35:02.897 17689-17998 D/MultiPointOutputStream: OutputStream start flush looper task[1] with syncBufferIntervalMills[2000] syncBufferSize[65536] 2021-08-31 14:35:02.897 17689-17996 D/MultiPointOutputStream: Create output stream write from (1) block(1) 3170981 2021-08-31 14:35:02.897 17689-17997 D/CallbackDispatcher: <----- finish connection task(1) block(2) code[206]{accept-ranges=[bytes], content-length=[3170979], content-range=[bytes 6341960-9512938/9512939], content-type=[application/vnd.android.package-archive], date=[Tue, 31 Aug 2021 06:35:02 GMT], last-modified=[Tue, 31 Aug 2021 05:24:23 GMT]} 2021-08-31 14:35:02.898 17689-17997 D/CallbackDispatcher: fetchStart: 1 2021-08-31 14:35:02.899 17689-17997 D/MultiPointOutputStream: Create output stream write from (1) block(2) 6341960 2021-08-31 14:35:02.899 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(1131) currentOffset(1131) 2021-08-31 14:35:04.014 17689-17992 D/RemitSyncExecutor: sync info with id: 1 2021-08-31 14:35:04.901 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 0 2021-08-31 14:35:04.922 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(487985) currentOffset(489116) 2021-08-31 14:35:04.927 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(682048) currentOffset(682048) 2021-08-31 14:35:04.932 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(422492) currentOffset(422492) 2021-08-31 14:35:06.933 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 0 2021-08-31 14:35:06.946 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(179052) currentOffset(668168) 2021-08-31 14:35:06.949 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(283152) currentOffset(965200) 2021-08-31 14:35:06.954 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(217916) currentOffset(640408) 2021-08-31 14:35:08.955 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 0 2021-08-31 14:35:08.991 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(544652) currentOffset(1212820) 2021-08-31 14:35:08.995 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(715008) currentOffset(1680208) 2021-08-31 14:35:09.000 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(462596) currentOffset(1103004) 2021-08-31 14:35:11.001 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 0 2021-08-31 14:35:11.018 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(22564) currentOffset(1235384) 2021-08-31 14:35:11.022 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(128052) currentOffset(1808260) 2021-08-31 14:35:11.027 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(334508) currentOffset(1437512) 2021-08-31 14:35:13.028 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 0 2021-08-31 14:35:13.041 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(490620) currentOffset(1726004) 2021-08-31 14:35:13.043 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(580896) currentOffset(2389156) 2021-08-31 14:35:13.046 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(427504) currentOffset(1865016) 2021-08-31 14:35:15.047 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 0 2021-08-31 14:35:15.084 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(198840) currentOffset(1924844) 2021-08-31 14:35:15.088 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(308136) currentOffset(2697292) 2021-08-31 14:35:15.093 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(290092) currentOffset(2155108) 2021-08-31 14:35:17.095 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 0 2021-08-31 14:35:17.112 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(163784) currentOffset(2088628) 2021-08-31 14:35:17.117 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(281444) currentOffset(2978736) 2021-08-31 14:35:17.121 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(159620) currentOffset(2314728) 2021-08-31 14:35:18.551 17689-17996 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 1 2021-08-31 14:35:18.554 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 1 2021-08-31 14:35:18.554 17689-17998 D/MultiPointOutputStream: runSync state change isNoMoreStream[false] newNoMoreStreamBlockList[[1]] 2021-08-31 14:35:18.572 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(0) syncLength(163784) currentOffset(2252412) 2021-08-31 14:35:18.575 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(1) syncLength(192243) currentOffset(3170979) 2021-08-31 14:35:18.578 17689-17998 D/MultiPointOutputStream: OutputStream sync success (1) block(2) syncLength(201260) currentOffset(2515988) 2021-08-31 14:35:18.579 17689-17996 D/MultiPointOutputStream: OutputStream close task[1] block[1] 2021-08-31 14:35:18.579 17689-17996 D/CallbackDispatcher: fetchEnd: 1 2021-08-31 14:35:18.581 17689-18009 D/DownloadChain: release connection com.liulishuo.okdownload.core.connection.DownloadOkHttp3Connection@a6e7460 task[1] block[1] #####################失败提示###################### 2021-08-31 14:35:20.579 17689-17998 D/MultiPointOutputStream: task[1] current need fetching block count 3 is not equal to no more stream block count 1 2021-08-31 14:35:21.212 17689-17997 D/MultiPointOutputStream: OutputStream done but no need to ensure sync, because the syncFuture.isDone[true] task[1] block[2] 2021-08-31 14:35:21.212 17689-17997 D/MultiPointOutputStream: OutputStream close task[1] block[2] 2021-08-31 14:35:21.215 17689-17997 D/DownloadCache: catch unknown error java.io.IOException: The current offset on block-info isn't update correct, 2515988 != 3170979 on 2 2021-08-31 14:35:21.216 17689-18009 D/DownloadChain: release connection com.liulishuo.okdownload.core.connection.DownloadOkHttp3Connection@abcfd19 task[1] block[2] 2021-08-31 14:35:21.832 17689-17995 D/MultiPointOutputStream: OutputStream done but no need to ensure sync, because the syncFuture.isDone[true] task[1] block[0] 2021-08-31 14:35:21.833 17689-17995 D/MultiPointOutputStream: OutputStream close task[1] block[0] 2021-08-31 14:35:21.835 17689-17989 D/CallbackDispatcher: taskEnd: 1 ERROR java.io.IOException: The current offset on block-info isn't update correct, 2515988 != 3170979 on 2

2021-08-31 14:35:21.835 17689-17989 D/DownloadCall: call is finished 1 2021-08-31 14:35:21.835 17689-17992 D/RemitSyncExecutor: remove free bunch id 1 2021-08-31 14:35:21.939 17689-18009 D/DownloadChain: release connection com.liulishuo.okdownload.core.connection.DownloadOkHttp3Connection@1eb91de task[1] block[0]

Bter commented 2 years ago

和这里是一样的原因:Download error The current offset on block-info isn't update correct, 1648345 != 11469669 on 0 V1.0.7版本还是遇到这个问题,导致任务中断,进度跳变 #415 临时解决方案