champage / shanting

Automatically exported from code.google.com/p/shanting
0 stars 0 forks source link

下载部分优化 #83

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
bug比较多,批量下载容易无响应,整体需要优化

Original issue reported on code.google.com by lxyyzm@gmail.com on 11 Oct 2011 at 9:46

GoogleCodeExporter commented 9 years ago
1、文件长度计算错误,目前文件长度=Content-Range报文中的长��
�-1,正确的做法是不用-1;
2、在下载管理界面,不停的点击继续/暂停,循环点击,容易
出现任务不受控制的情形,就是怎么停都停不掉;(原因是因�
��taskCanceled函数点击时被调用了一次,任务退出时候又调用了
一次,如果第一次任务还没有退出,第二次点击的任务加进��
�列后,第一次任务退出会将刚加进队列中的任务remove掉,然�
��再点击的时候就没法暂停了)

Original comment by liuh...@gmail.com on 31 Mar 2012 at 2:17

GoogleCodeExporter commented 9 years ago
3、在下载管理界面,移除一个下载任务后,偶尔会出现移除�
��,任务又继续运行的情况,原因是因为移除任务时,正好碰
到任务下载失败正在重试的情况,重试时会将m_Running设置为tr
ue,导致任务继续运行;
4、下载管理界面,任务下载如果失败后重试,且正在下载,�
��时停止不了任务,原因是因为taskFailed会将任务从任务管理��
�列中移除,导致无法控制任务的启停状态;

Original comment by liuh...@gmail.com on 3 Apr 2012 at 7:36

GoogleCodeExporter commented 9 years ago

Original comment by yipengfa...@gmail.com on 19 Jun 2012 at 10:18

GoogleCodeExporter commented 9 years ago
The change for this is done now.

Original comment by lxyyzm@gmail.com on 26 Jun 2012 at 3:31

GoogleCodeExporter commented 9 years ago
发现在下载管理中对一个任务不停的开始暂停,偶尔出现停��
�不了的问题。

Original comment by liuh...@gmail.com on 27 Jun 2012 at 2:59

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
开始->暂停->开始,由于暂停时stopDownloadTask中调用了一次taskCa
nceled,同时在DownloadTask的run中也调用了一次,这样DownloadTask的r
un函数的taskCanceled偶尔会比第二次开始任务晚,这样就把第二
次开始的任务删除掉了,导致第二次开始的任务无法暂停。

06-27 11:01:28.829: V/MyLog(8614): [ 1: DownloadService.java:548 ] - 
DownloadService startDownloadTask() ---> Enter
06-27 11:01:28.829: V/MyLog(8614): [ 1: DownloadService.java:561 ] - SD card 
status is mounted
06-27 11:01:28.929: E/MyLog(8614): [ 1: DownloadService.java:591 ] - 
startDownloadTask t = tiger.unfamous.download.DownloadTask@407eb5f0item_id = 67
06-27 11:01:28.929: I/MyLog(8614): [ 24: DownloadTask.java:348 ] - DownloadTask 
run
06-27 11:01:28.929: D/MyLog(8614): [ 24: DownloadService.java:1039 ] - 
taskStarted:--------------->enter!
06-27 11:01:28.939: V/MyLog(8614): [ 1: DownloadService.java:603 ] - 
startDownloadTask() ---> Exit
06-27 11:01:29.059: D/MyLog(8614): [ 24: DownloadService.java:1052 ] - 
taskStarted:--------------->exit!
06-27 11:01:29.069: V/MyLog(8614): [ 24: DownloadTask.java:108 ] - get() ---> 
Enter
06-27 11:01:29.069: I/MyLog(8614): [ 24: DownloadTask.java:134 ] - folder is : 
/mnt/sdcard/善听/历史是个什么玩意儿上
06-27 11:01:29.079: I/MyLog(8614): [ 24: DownloadTask.java:162 ] - 
m_downloadSize is 1793884
06-27 11:01:30.859: V/MyLog(8614): [ 1: DownloadService.java:650 ] - 
stopDownloadTask() ---> Enter
06-27 11:01:30.859: E/MyLog(8614): [ 1: DownloadService.java:652 ] - 
stopDownloadTask  t = tiger.unfamous.download.DownloadTask@407eb5f0item_id = 67
06-27 11:01:30.859: V/MyLog(8614): [ 1: DownloadService.java:741 ] - 
DownloadService taskCancelled:--------------->enter!
06-27 11:01:30.969: V/MyLog(8614): [ 1: DownloadService.java:758 ] - item id=67
06-27 11:01:30.969: V/MyLog(8614): [ 1: DownloadService.java:759 ] - 
taskCancelled:--------------->exit!
06-27 11:01:30.969: V/MyLog(8614): [ 1: DownloadService.java:665 ] - 
stopDownloadTask() ---> Exit
06-27 11:01:32.059: V/MyLog(8614): [ 1: DownloadService.java:548 ] - 
DownloadService startDownloadTask() ---> Enter
06-27 11:01:32.059: V/MyLog(8614): [ 1: DownloadService.java:561 ] - SD card 
status is mounted
06-27 11:01:32.129: E/MyLog(8614): [ 1: DownloadService.java:591 ] - 
startDownloadTask t = tiger.unfamous.download.DownloadTask@4077e980item_id = 67
06-27 11:01:32.129: V/MyLog(8614): [ 1: DownloadService.java:603 ] - 
startDownloadTask() ---> Exit
06-27 11:01:32.209: I/MyLog(8614): [ 24: DownloadTask.java:190 ] - 
Content-Range is bytes 1793884-5374118/5374119
06-27 11:01:32.209: V/MyLog(8614): [ 24: DownloadTask.java:198 ] - HttpResponse 
is 3580235
06-27 11:01:32.249: V/MyLog(8614): [ 24: DownloadTask.java:199 ] - getFileSize 
of database is 5374119
06-27 11:01:32.269: V/MyLog(8614): [ 24: DownloadTask.java:200 ] - getFileSize 
of downloadItem is 5374119
06-27 11:01:32.359: V/MyLog(8614): [ 24: DownloadTask.java:110 ] - get() ---> 
Exit
06-27 11:01:32.359: V/MyLog(8614): [ 24: DownloadService.java:741 ] - 
DownloadService taskCancelled:--------------->enter!
06-27 11:01:32.409: V/MyLog(8614): [ 24: DownloadService.java:758 ] - item id=67
06-27 11:01:32.409: V/MyLog(8614): [ 24: DownloadService.java:759 ] - 
taskCancelled:--------------->exit!
06-27 11:01:32.419: I/MyLog(8614): [ 24: DownloadTask.java:348 ] - DownloadTask 
run
06-27 11:01:32.419: D/MyLog(8614): [ 24: DownloadService.java:1039 ] - 
taskStarted:--------------->enter!
06-27 11:01:32.469: D/MyLog(8614): [ 24: DownloadService.java:1052 ] - 
taskStarted:--------------->exit!
06-27 11:01:32.469: V/MyLog(8614): [ 24: DownloadTask.java:108 ] - get() ---> 
Enter
06-27 11:01:32.469: I/MyLog(8614): [ 24: DownloadTask.java:134 ] - folder is : 
/mnt/sdcard/善听/历史是个什么玩意儿上
06-27 11:01:32.479: I/MyLog(8614): [ 24: DownloadTask.java:162 ] - 
m_downloadSize is 1793884
06-27 11:01:32.849: I/MyLog(8614): [ 24: DownloadTask.java:190 ] - 
Content-Range is bytes 1793884-5374118/5374119
06-27 11:01:32.849: V/MyLog(8614): [ 24: DownloadTask.java:198 ] - HttpResponse 
is 3580235
06-27 11:01:32.879: V/MyLog(8614): [ 24: DownloadTask.java:199 ] - getFileSize 
of database is 5374119
06-27 11:01:32.879: V/MyLog(8614): [ 24: DownloadTask.java:200 ] - getFileSize 
of downloadItem is 5374119

06-27 11:01:35.199: V/MyLog(8614): [ 1: DownloadService.java:650 ] - 
stopDownloadTask() ---> Enter
06-27 11:01:35.209: E/MyLog(8614): [ 1: DownloadService.java:652 ] - 
stopDownloadTask  t = nullitem_id = 67
06-27 11:01:35.209: V/MyLog(8614): [ 1: DownloadService.java:665 ] - 
stopDownloadTask() ---> Exit

Original comment by liuh...@gmail.com on 27 Jun 2012 at 3:24

GoogleCodeExporter commented 9 years ago
加上日志,复现问题,证明了上次的猜测是正确的。
06-27 11:38:40.199: V/MyLog(8973): [ 1: DownloadService.java:548 ] - 
DownloadService startDownloadTask() ---> Enter
06-27 11:38:40.199: V/MyLog(8973): [ 1: DownloadService.java:561 ] - SD card 
status is mounted
06-27 11:38:40.289: E/MyLog(8973): [ 1: DownloadService.java:591 ] - 
startDownloadTask t = tiger.unfamous.download.DownloadTask@4067b140item_id = 96
06-27 11:38:40.289: I/MyLog(8973): [ 32: DownloadTask.java:348 ] - DownloadTask 
run
06-27 11:38:40.289: D/MyLog(8973): [ 32: DownloadService.java:1043 ] - 
taskStarted:--------------->enter!
06-27 11:38:40.309: V/MyLog(8973): [ 1: DownloadService.java:603 ] - 
startDownloadTask() ---> Exit
06-27 11:38:40.359: D/MyLog(8973): [ 32: DownloadService.java:1056 ] - 
taskStarted:--------------->exit!
06-27 11:38:40.369: V/MyLog(8973): [ 32: DownloadTask.java:108 ] - get() ---> 
Enter
06-27 11:38:40.369: I/MyLog(8973): [ 32: DownloadTask.java:134 ] - folder is : 
/mnt/sdcard/善听/历史是个什么玩意儿上
06-27 11:38:40.399: I/MyLog(8973): [ 32: DownloadTask.java:162 ] - 
m_downloadSize is 0
06-27 11:38:41.579: V/MyLog(8973): [ 1: DownloadService.java:650 ] - 
stopDownloadTask() ---> Enter
06-27 11:38:41.579: E/MyLog(8973): [ 1: DownloadService.java:652 ] - 
stopDownloadTask  t = tiger.unfamous.download.DownloadTask@4067b140item_id = 96
06-27 11:38:41.579: V/MyLog(8973): [ 1: DownloadService.java:741 ] - 
DownloadService taskCancelled:--------------->enter!
06-27 11:38:41.699: V/MyLog(8973): [ 1: DownloadService.java:762 ] - item id=96
06-27 11:38:41.699: V/MyLog(8973): [ 1: DownloadService.java:763 ] - 
taskCancelled:--------------->exit!
06-27 11:38:41.699: V/MyLog(8973): [ 1: DownloadService.java:665 ] - 
stopDownloadTask() ---> Exit
06-27 11:38:42.719: V/MyLog(8973): [ 1: DownloadService.java:548 ] - 
DownloadService startDownloadTask() ---> Enter
06-27 11:38:42.719: V/MyLog(8973): [ 1: DownloadService.java:561 ] - SD card 
status is mounted
06-27 11:38:43.019: E/MyLog(8973): [ 1: DownloadService.java:591 ] - 
startDownloadTask t = tiger.unfamous.download.DownloadTask@40687f10item_id = 96
06-27 11:38:43.019: V/MyLog(8973): [ 1: DownloadService.java:603 ] - 
startDownloadTask() ---> Exit
06-27 11:38:43.509: I/MyLog(8973): [ 32: DownloadTask.java:190 ] - 
Content-Range is bytes 0-4585626/4585627
06-27 11:38:43.519: V/MyLog(8973): [ 32: DownloadTask.java:198 ] - HttpResponse 
is 4585627
06-27 11:38:43.599: V/MyLog(8973): [ 32: DownloadTask.java:199 ] - getFileSize 
of database is 4585627
06-27 11:38:43.599: V/MyLog(8973): [ 32: DownloadTask.java:200 ] - getFileSize 
of downloadItem is 4585627
06-27 11:38:43.609: V/MyLog(8973): [ 32: DownloadTask.java:110 ] - get() ---> 
Exit
06-27 11:38:43.609: V/MyLog(8973): [ 32: DownloadService.java:741 ] - 
DownloadService taskCancelled:--------------->enter!
06-27 11:38:43.619: E/MyLog(8973): [ 32: DownloadService.java:744 ] - 
taskCancelled error!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
06-27 11:38:43.669: V/MyLog(8973): [ 32: DownloadService.java:762 ] - item id=96
06-27 11:38:43.669: V/MyLog(8973): [ 32: DownloadService.java:763 ] - 
taskCancelled:--------------->exit!
06-27 11:38:43.669: I/MyLog(8973): [ 32: DownloadTask.java:348 ] - DownloadTask 
run
06-27 11:38:43.669: D/MyLog(8973): [ 32: DownloadService.java:1043 ] - 
taskStarted:--------------->enter!
06-27 11:38:43.739: D/MyLog(8973): [ 32: DownloadService.java:1056 ] - 
taskStarted:--------------->exit!
06-27 11:38:43.749: V/MyLog(8973): [ 32: DownloadTask.java:108 ] - get() ---> 
Enter
06-27 11:38:43.749: I/MyLog(8973): [ 32: DownloadTask.java:134 ] - folder is : 
/mnt/sdcard/善听/历史是个什么玩意儿上
06-27 11:38:43.749: I/MyLog(8973): [ 32: DownloadTask.java:162 ] - 
m_downloadSize is 0
06-27 11:38:43.869: I/MyLog(8973): [ 32: DownloadTask.java:190 ] - 
Content-Range is bytes 0-4585626/4585627
06-27 11:38:43.869: V/MyLog(8973): [ 32: DownloadTask.java:198 ] - HttpResponse 
is 4585627
06-27 11:38:43.869: V/MyLog(8973): [ 32: DownloadTask.java:199 ] - getFileSize 
of database is 4585627
06-27 11:38:43.869: V/MyLog(8973): [ 32: DownloadTask.java:200 ] - getFileSize 
of downloadItem is 4585627
06-27 11:38:44.759: V/MyLog(8973): [ 1: DownloadService.java:650 ] - 
stopDownloadTask() ---> Enter
06-27 11:38:44.759: E/MyLog(8973): [ 1: DownloadService.java:652 ] - 
stopDownloadTask  t = nullitem_id = 96
06-27 11:38:44.759: V/MyLog(8973): [ 1: DownloadService.java:665 ] - 
stopDownloadTask() ---> Exit
06-27 11:38:47.209: V/MyLog(8973): [ 1: DownloadService.java:650 ] - 
stopDownloadTask() ---> Enter
06-27 11:38:47.219: E/MyLog(8973): [ 1: DownloadService.java:652 ] - 
stopDownloadTask  t = nullitem_id = 96
06-27 11:38:47.219: V/MyLog(8973): [ 1: DownloadService.java:665 ] - 
stopDownloadTask() ---> Exit

Original comment by liuh...@gmail.com on 27 Jun 2012 at 3:41

GoogleCodeExporter commented 9 years ago
修改shutdownExecutor中关闭等待任务的问题,之前使用的HashMap遍
历,无法保证关闭顺序跟任务开始的顺序一致,修改成获取��
�程池的顺序队列,通过顺序队列进行关闭。

Original comment by liuh...@gmail.com on 27 Jun 2012 at 6:22

GoogleCodeExporter commented 9 years ago

Original comment by lxyyzm@gmail.com on 4 Jul 2012 at 1:15

GoogleCodeExporter commented 9 years ago

Original comment by yipengfa...@gmail.com on 10 Jul 2012 at 6:35

GoogleCodeExporter commented 9 years ago

Original comment by yipengfa...@gmail.com on 23 Jul 2012 at 1:59

GoogleCodeExporter commented 9 years ago

Original comment by liuh...@gmail.com on 27 Jul 2012 at 8:40

GoogleCodeExporter commented 9 years ago

Original comment by lxyyzm@gmail.com on 30 Jul 2012 at 3:40

GoogleCodeExporter commented 9 years ago

Original comment by liuh...@gmail.com on 9 Aug 2012 at 1:18

GoogleCodeExporter commented 9 years ago

Original comment by liuh...@gmail.com on 9 Aug 2012 at 6:31

GoogleCodeExporter commented 9 years ago

Original comment by liuh...@gmail.com on 13 Aug 2012 at 8:44

GoogleCodeExporter commented 9 years ago

Original comment by liuh...@gmail.com on 15 Aug 2012 at 3:09

GoogleCodeExporter commented 9 years ago
先关闭,发现问题了可以重新提issue。

Original comment by liuh...@gmail.com on 23 Aug 2012 at 12:42

GoogleCodeExporter commented 9 years ago

Original comment by lxyyzm@gmail.com on 23 Aug 2012 at 7:33