-
Notifications
You must be signed in to change notification settings - Fork 316
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
Error "Requested data is before the reader's current offset" for Upload(stream) when resumption creates a new upload #580
Comments
This issue is made more likely to crop up by issue #579, as that increases the chances that "a transmission error occurs and resumption fails". |
Yes, that is correct. There is currently no way how an upload could succeed from such kind of failures. The question is how can we improve this situation in tus-js-client? a) Just raise a different error saying that we cannot resume in such a case |
Yes, I think the following would make sense:
Isn't this theoretically already possible, by providing an arbitrary object as the argument to the As a concrete example of how I found a bug in Chrome "FileReader 5x slower than in Firefox over Windows Share". It limits sequential |
I am wondering if we currently have the capabilities to detect this state inside the
Good point. That might be, although I never tried it. Plus I think this approach is a rather unintuitive way for most casual tus-js-client users. If we go and embrace a setup where a new stream can be supplied to tus-js-client, I would prefer it being done using a more explicit API. |
The error
Requested data is before the reader's current offset
fromtus-js-client/lib/browser/sources/StreamSource.js
Lines 38 to 39 in 01d3948
is triggered when the following conditions are met jointly:
new Upload(new ReadableStream(...))
is usedchunkSize
is set and the upload progressed to the second or higher chunk502 Bad Gateway
, or any of these designed situations occurs(These conditions are true in common cases, e.g. when you're behind Cloudflare (requiring
chunkSize
) and you restart your TUS server software for a split second for an upgrade.)Then, this code triggers:
tus-js-client/lib/upload.js
Lines 672 to 675 in 01d3948
which creates a completely new upload with offset
0
, but it seems that theReadableStream
is not reset and can already be way further advanced.Hence,
Requested data is before the reader's current offset
necessarily triggers.Automatically creating a new upload in the middle of the transfer seems logically impossible when the Upload is sourced by a
ReadableStream
, as the user is given no opportunity to create a stream on which another.slice(0, ...)
can succeed.The text was updated successfully, but these errors were encountered: