-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@tus/s3-store: failed part upload crashes entire server #722
Comments
I think this issue could be somehow "managed" with a simple modification. When a
Error will properly be propagated as part of pipeline. Error 500 will be sent to client and server does not crash.
Next issue is that This could be solved with next change. First wait for all promises to settle (either successfully or not) and then reject with an error if necessary.
Next problem is with |
I think it would be nice to fix and release this on 1.x before doing the major release. I don't like bug fixes on major releases. Since you wrote the plan down already, do you also want to work on it? |
I can solve issues with S3 store regarding how it handles errors from S3 provider. Issues with locking mechanism and |
When
uploadPart
oruploadIncompletePart
throws (is rejected) entire server crashes. This happens often with Scaleway Object Storage as their service fails with error 500 with non-informative console messageAn error was encountered in a non-retryable streaming request.
from AWS library. After listening forunhandledRejection
event I got some more information.I believe the problem is that when a
deferred
promise is created it does not handle rejections. It is only inserted into a list.tus-node-server/packages/s3-store/src/index.ts
Line 421 in 81eb03a
At the end promises are aggregated with
Promise.all
and returned to the caller where an rejection handler is eventually added.tus-node-server/packages/s3-store/src/index.ts
Line 440 in 81eb03a
tus-node-server/packages/server/src/server.ts
Line 188 in 81eb03a
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.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()
andpermit?.release()
are also not handled and would cause server to crash.The text was updated successfully, but these errors were encountered: