@tus/s3-store: failed part upload crashes entire server
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- aws, typescript
Hướng nghiên cứu
Start in packages/s3-store/src/index.ts at the deferred promises around lines 421 and 440, then inspect packages/server/src/server.ts around line 188 to trace rejection handling. Reproduce an uploadPart or uploadIncompletePart rejection, including permit.release() failures, and verify that the server remains running while the current upload returns HTTP 500.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When uploadPart or uploadIncompletePart throws (is rejected) entire server crashes. This happens often with Scaleway Object Storage as their service fails with error 500 with non-informative console message An error was encountered in a non-retryable streaming request. from AWS library. After listening for unhandledRejection event I got some more information.
Unhandled Rejection at: Promise {
<rejected> S3ServiceException [InternalError]: We encountered an internal error. Please try again.
at throwDefaultError (/app/node_modules/@smithy/smithy-client/dist-cjs/index.js:867:20)
at /app/node_modules/@smithy/smithy-client/dist-cjs/index.js:876:5
at de_CommandError (/app/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:4965:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
at async /app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:483:18
at async /app/node_modules/@smithy/middleware-retry/dist-cjs/index.js:321:38
at async /app/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/index.js:315:18
at async /app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:109:22
at async /app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:136:14 {
'$fault': 'client',
'$metadata': {
httpStatusCode: 500,
requestId: 'txg5c09a7e2fbe14ba89375-0067aa0421',
extendedRequestId: 'txg5c09a7e2fbe14ba89375-0067aa0421',
cfId: undefined
},
Code: 'InternalError',
RequestId: 'txg5c09a7e2fbe14ba89375-0067aa0421',
HostId: 'txg5c09a7e2fbe14ba89375-0067aa0421',
Resource: '<s3-object-key>.bin'
},
I believe the problem is that when a deferred promise is created it does not handle rejections. It is only inserted into a list.
https://github.com/tus/tus-node-server/blob/81eb03a82658b2e5e97abdb05c26418192320724/packages/s3-store/src/index.ts#L421
At the end promises are aggregated with Promise.all and returned to the caller where an rejection handler is eventually added.
https://github.com/tus/tus-node-server/blob/81eb03a82658b2e5e97abdb05c26418192320724/packages/s3-store/src/index.ts#L440
https://github.com/tus/tus-node-server/blob/81eb03a82658b2e5e97abdb05c26418192320724/packages/server/src/server.ts#L188
During this period if any of the promises in a list are rejected, the rejection is not handled.
Steps to reproduce
Use S3 server that sometimes throws errors (e.g. Scaleway Object Storage) or manually throw error. I modified uploadPart(metadata, readStream, partNumber) to randomly reject. Add provided snippet at the top of this function. This will result in server crash.
const errorProbability = Math.random()
if (errorProbability < 0.2) {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('test'));
}, 1000);
})
}
Expected behavior
Server should not crash. Failed part upload should end the current upload with HTTP 500 Internal Server Error status code.
Observation
Promises (rejections) returned by acquiredPermit?.release() and permit?.release() are also not handled and would cause server to crash.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.1k
- Fork
- 228
- Merge trung bình
- 4 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tus/tus-node-server
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
tus/tus-node-server#884 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
tus/tus-node-server#807 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Datastore dynamicĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
tus/tus-node-server#737 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
tus/tus-node-server#521 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
tus/tus-node-server#380 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của tus/tus-node-server
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BeOS .json missingĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mihaip/infinite-mac#475 ·
-
Let TypeScript accept an initial object in ReactiveDictCó thể đã có người làm @yograj-vijay-yadav đã nhận hôm nay. Đang mởbug good first issue help wanted workshop
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
meteor/meteor#14919 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
marmelab/atomic-crm#401 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
account: profile
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 5 ngày