uppy: "Timed out waiting for socket" when attempting to upload multiple large files via Companion
Hi all,
I’m using Uppy/Companion to offer file uploads from remote sources, and am hitting “Timed out waiting for socket connection” reliably in the following use case:
- Connect to any remote source (Google Drive or DropBox in my case) that has a bunch of large files. I have 10 video files at 300+MB each.
- Attempt to upload all 10 files at the same time.
- Notice that 3 files start uploading.
- After 60 seconds pass, server reports “Timed out waiting for socket connection” for the other 7 files.
- The 3 files that were uploading complete after a while, and progress for the bulk upload hangs. No UI error is reported for the failed 7 files, nor is an option presented to retry.
I have Tus and AwsS3Multipart set up as mutually-exclusive destinations, with both their limit config set to 3. The timeout occurs when either one is used, so it’s destination-agnostic.
Debugging
It looks like Companion attempts to assign sockets (apparently limited by the limit config for the destination) to every file the moment they’re added to the upload batch, and starts a timeout for those that miss out on the first attempt. If no socket frees up in time (default 60000ms), the timeout error will be thrown on the server for any file still waiting on a socket. This leaves the UI in a seemingly frozen state, with no indication of a problem or offer to retry.
Probable expected behavior
Perhaps socket assignment should be attempted only when they free up? The current approach works for many smaller files, but easily breaks if the files are too large or if the connection’s slow at any given time.
What I’ve tried
- Leaving the
limitunset on the destination configs would allow all files to be assigned sockets immediately, but this workaround is not desirable, since the limit was placed to keep upload rates manageable. - Setting
streamingUploadtotruebased on the similarity of the problem described in https://github.com/transloadit/uppy/issues/3098 didn’t fix the problem.
Thanks for any help!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (8 by maintainers)
Commits related to this issue
- @uppy/xhr-upload: fix `Timed out waiting for socket` Fixes: https://github.com/transloadit/uppy/issues/3640 — committed to aduh95/uppy by aduh95 2 years ago
- @uppy/xhr-upload: fix `Timed out waiting for socket` Fixes: https://github.com/transloadit/uppy/issues/3640 Co-authored-by: Merlijn Vos <merlijn@soverin.net> — committed to aduh95/uppy by aduh95 2 years ago
- @uppy/xhr-upload: fix `Timed out waiting for socket` (#4150) Fixes: https://github.com/transloadit/uppy/issues/3640 Co-authored-by: Merlijn Vos <merlijn@soverin.net> — committed to transloadit/uppy by aduh95 2 years ago
- @uppy/xhr-upload: fix `Timed out waiting for socket` (#4150) Fixes: https://github.com/transloadit/uppy/issues/3640 Co-authored-by: Merlijn Vos <merlijn@soverin.net> (cherry picked from commit f75285... — committed to transloadit/uppy by aduh95 2 years ago
@Murderlon Ok, thanks for the update… indeed, a bit more complex than I thought. I appreciate you trying to solve it the right way.
We went ahead and implemented a band-aid patch to limit concurrency by
req.companion.providerToken, which seems to be working well. However, we would love the issue solved correctly so we can stay up to date and not have to be patching.