1、HTTP 请求失败,报错:Curl error: #55 – TCP connection reset by peer。在请求企鹅号的视频文件分片上传接口时。如图1
[24] common/jobs/UploadAssetJob (attempt: 1, PID: 14829) is finished with error: yii/httpclient/Exception: Curl error: #55 - TCP connection reset by peer in /mcloud/www/ccp_api/vendor/yiisoft/yii2-httpclient/src/CurlTransport.php:50 Stack trace: #0 /mcloud/www/ccp_api/vendor/yiisoft/yii2-httpclient/src/Client.php(233): yii/httpclient/CurlTransport->send(Object(yii/httpclient/Request)) #1 /mcloud/www/ccp_api/vendor/yiisoft/yii2-httpclient/src/Request.php(444): yii/httpclient/Client->send(Object(yii/httpclient/Request)) #2 /mcloud/www/ccp_api/common/logics/http/qq_api/Video.php(217): yii/httpclient/Request->send() #3 /mcloud/www/ccp_api/common/services/QqTpVideoMultipartUploadService.php(110): common/logics/http/qq_api/Video->authUploadTrunk(Array) #4 /mcloud/www/ccp_api/common/services/QqTpVideoMultipartUploadService.php(194): common/services/QqTpVideoMultipartUploadService->httpUploadTrunk(Array) #5 /mcloud/www/ccp_api/common/services/QqTpAssetService.php(183): common/services/QqTpVideoMultipartUploadService->upload(24, 43) #6 /mcloud/www/ccp_api/common/jobs/UploadAssetJob.php(120): common/services/QqTpAssetService::uploadAssetVideoMultipartSync(24, 364) #7 /mcloud/www/ccp_api/vendor/yiisoft/yii2-queue/src/Queue.php(246): common/jobs/UploadAssetJob->execute(Object(yii/queue/redis/Queue)) #8 /mcloud/www/ccp_api/vendor/yiisoft/yii2-queue/src/cli/Queue.php(162): yii/queue/Queue->handleMessage('24', 'O:26:"common//jo...', '7200', '1') #9 /mcloud/www/ccp_api/vendor/yiisoft/yii2-queue/src/cli/Command.php(146): yii/queue/cli/Queue->execute('24', 'O:26:"common//jo...', '7200', '1', '14829') #10 [internal function]: yii/queue/cli/Command->actionExec('24', '7200', '1', '14829') #11 /mcloud/www/ccp_api/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #12 /mcloud/www/ccp_api/vendor/yiisoft/yii2/base/Controller.php(181): yii/base/InlineAction->runWithParams(Array) #13 /mcloud/www/ccp_api/vendor/yiisoft/yii2/console/Controller.php(184): yii/base/Controller->runAction('exec', Array) #14 /mcloud/www/ccp_api/vendor/yiisoft/yii2/base/Module.php(534): yii/console/Controller->runAction('exec', Array) #15 /mcloud/www/ccp_api/vendor/yiisoft/yii2/console/Application.php(181): yii/base/Module->runAction('upload-asset-qu...', Array) #16 /mcloud/www/ccp_api/vendor/yiisoft/yii2/console/Application.php(148): yii/console/Application->runAction('upload-asset-qu...', Array) #17 /mcloud/www/ccp_api/vendor/yiisoft/yii2/base/Application.php(392): yii/console/Application->handleRequest(Object(yii/console/Request)) #18 /mcloud/www/ccp_api/yii(23): yii/base/Application->run() #19 {main}.
2、查看视频文件的大小:1554129526 / 1024 / 1024 = 1482.13 MB。如图2
3、查看企鹅号的视频文件分片上传。start_offset:分片的起始位置(从0开始计数)。end_offset:分片的结束位置。status:状态,0:禁用;1:待上传;2:上传中;3:上传中(已失败);4:已上传。发现状态为3,即上传中(已失败)。已经上传至第 4 个分片,419430400 / 1024 / 1024 = 400 MB。单个分片文件大小为 100 MB。如图3
4、第 5 个分片的起始位置:524288,000,那么第 4 个分片的结束位置:524287999,其值是正确的。查看存储中的原始文件:/2021/10/22/1634900031.6087.46572291.mp4,分片文件的数量总计为 15 个。分片文件不存在问题。如图4
[root@api-589cf86d4c-rx5gw 22]# ls -lrt -rw-r--r-- 1 65534 65534 1554129526 Oct 22 18:54 1634900031.6087.46572291.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:55 1634900031.6087.46572291_0.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:55 1634900031.6087.46572291_1.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:55 1634900031.6087.46572291_2.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:55 1634900031.6087.46572291_3.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_4.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_5.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_6.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_7.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_8.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_9.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_10.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_11.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_12.mp4 -rw-r--r-- 1 65534 65534 104857600 Oct 22 18:56 1634900031.6087.46572291_13.mp4 -rw-r--r-- 1 65534 65534 86123126 Oct 22 18:56 1634900031.6087.46572291_14.mp4
5、使用同样的视频文件再次上传,上传成功,未复现。以下是事务表中的 3 次记录。如图5
start_offset end_offset status 629145600 734003199 2 1258291200 1363148799 2 1554129526 1554129526 4
6、总结:看来只有后续让测试人员再复现一下了。开发人员未复现的。这应该也是偶发问题的。基本上是很难解决了。比如说因为网络抖动、或者说企鹅号的服务器偶发不稳定。
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/181767.html