没有不值得去解决的问题,也没有不值得去学习的技术!

HTTP Request to Tencent Video Chunk Upload API Fails With Curl Error: #55 – TCP Connection Reset by Peer

The HTTP request failed with the error: Curl error: #55 - TCP connection reset by peer. This occurred when requesting the Penguin Account's video file multipart upload interface.

1. The HTTP request failed with the error: Curl error: #55 – TCP connection reset by peer. This occurred when requesting the Penguin Account’s video file multipart upload interface. See Figure 1.

The HTTP request failed with the error: Curl error: #55 - TCP connection reset by peer. This occurred when requesting the Penguin Account's video file multipart upload interface.
Figure 1
Plaintext

[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. Check the video file size: 1554129526 / 1024 / 1024 = 1482.13 MB. See Figure 2.

Check the video file size: 1554129526 / 1024 / 1024 = 1482.13 MB.
Figure 2

3. Check the Penguin Account’s video file multipart upload. start_offset: the starting position of the chunk (counting from 0). end_offset: the ending position of the chunk. status: status, 0: disabled; 1: pending upload; 2: uploading; 3: uploading (failed); 4: uploaded. The status was found to be 3, meaning uploading (failed). It had already uploaded to the 4th chunk, 419430400 / 1024 / 1024 = 400 MB. The size of a single chunk file is 100 MB. See Figure 3.

Check the Penguin Account's video file multipart upload. start_offset: the starting position of the chunk (counting from 0). end_offset: the ending position of the chunk. status: status, 0: disabled; 1: pending upload; 2: uploading; 3: uploading (failed); 4: uploaded. The status was found to be 3, meaning uploading (failed). It had already uploaded to the 4th chunk, 419430400 / 1024 / 1024 = 400 MB. The size of a single chunk file is 100 MB.
Figure 3

4. The starting position of the 5th chunk is 524288,000, so the ending position of the 4th chunk is 524287999, which is correct. Check the original file in storage: /2021/10/22/1634900031.6087.46572291.mp4. The total number of chunk files is 15. There are no issues with the chunk files. See Figure 4.

The starting position of the 5th chunk is 524288,000, so the ending position of the 4th chunk is 524287999, which is correct. Check the original file in storage: /2021/10/22/1634900031.6087.46572291.mp4. The total number of chunk files is 15. There are no issues with the chunk files.
Figure 4
Plaintext

[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. Uploading the same video file again succeeded, and the issue did not reproduce. Below are 3 records from the transaction table. See Figure 5.

Uploading the same video file again succeeded, and the issue did not reproduce. Below are 3 records from the transaction table.
Figure 5
Plaintext

start_offset    end_offset    status
629145600       734003199     2
1258291200      1363148799    2
1554129526      1554129526    4   

6. Summary: It seems the only next step is to have the QA team try to reproduce it later. The developers could not reproduce it. This should also be an intermittent issue. It is basically very difficult to resolve. For example, it could be due to network jitter or occasional instability of the Penguin Account servers.

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系