-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Uppy stuck in "Encoding..." state with error [Transloadit] Couldn’t find the file, it was likely removed in the process
#4815
Comments
That's odd, indeed. I looked at the Assembly status at https://api2.transloadit.com/assemblies/46140cb99b11473a8878b5dcfbd8e0a1 and there are a couple of things to note: The Assembly is created with one upload to be expected, but two files are uploaded via tus for it. From the logs, it appears as if these two tus uploads were started at basically the same time. One possible explanation is a race condition in companion or tus-js-client, which causes duplicate uploads to be created. The two uploads could also explain why the upload URL changed. That being said, I am not sure why the tus uploads include The two files from the tus uploads were also successfully added to the Assembly. Logs from the servers also indicate that jobs for extracting the metadata completed, so the files were properly imported into the api2. Although the uploads were finished and process by the api2, the assembly is marked as REQUEST_ABORT. I guess this is because
Do I need some secret credentials in my environment to do this? Can this also be reproduced when using something else than Dropbox? |
Ok this is very interesting, thanks!
yes. but maybe not for the URL plugin. at least you need inside
see also .env.example (although maybe not quite up to date)
I believe so, and it can be reproduced with the URL plugin. I wanted to ttry to reproduce it on transloadit.com but that is currently broken due to a different issue |
Thanks for the tips! I will wait what you and Merlijn discover. If there is a need for me, I can try to reproduce it as well :) |
We found out what's the cause. After a refactor (#4734), Uppy now sends the "resume" event right after starting an upload. This calls this.tus.start():
the problem is that this.tus.start() has already been called by companion when the upload started (some hundred milliseconds before). Calling tus.start() twice causes tus-js-client to start the same upload twice, but produce a new uploadUrls the second time, sent back to uppy. I'm not sure if this is intended behaviour in tus-js-client (start the same upload twice in parallel for the same assembly), but we will workaround the issue by implementing a simple state machine to prevent calling tus.start() if we are already in the paused state. for fun we tried to call tus.start() 3 times back-to-back and indeed it uploaded the file 3 times to the assembly. |
fixes #4815 also improve error logging when canceling
Now that you are talking about it, I remember that another user of tus-js-client also ran into duplicate uploads because of the same reason. I opened an issue in tus-js-client to implement protection against this in the future: tus/tus-js-client#659. Thanks for looking it this! |
* fix double uploads fixes #4815 also improve error logging when canceling * don't close socket when pausing because it prevented us from canceling an upload that is paused note that we here sacrifice the ability to pause uploads and have other uploads take over the paused upload's rate limit queue spot. this is sacrificed because we will soon remove the ability to pause/resume uploads anyways * Update packages/@uppy/companion/src/server/Uploader.js Co-authored-by: Merlijn Vos <[email protected]> * Revert "don't close socket when pausing" This reverts commit e4dbe77. --------- Co-authored-by: Merlijn Vos <[email protected]>
Initial checklist
Link to runnable example
No response
Steps to reproduce
yarn dev:with-companion
and the Transloadit(tus) plugin,Use for example DropBox, add a single file and upload it.
Expected behavior
Upload and encoding should succeed.
Actual behavior
This happens about 1 out of 5 times while testing. Upload succeeds but encoding gets stuck and this gets printed:
I've added logging in
#findFile
in the transloadit plugin:and with the logging I see:
Notice that
file.uploadURL
is different fromuploadedFile.tus_upload_url
. The domain names are different:singar.transloadit.com
vssighi.transloadit.com
and the ID:3e6ecb0595b4573e731d4792d658109f
vsb96ca0c4629ded60b37520a93a500406
. I believe this is the culprit, but I don't know how to correctly solve it. Note that this only happens some times when uploading. Most of the time, the URLs are the same.The text was updated successfully, but these errors were encountered: