Skip to content
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

Companion downloads/uploads never canceled #3155

Closed
1 of 2 tasks
mifi opened this issue Sep 1, 2021 · 4 comments
Closed
1 of 2 tasks

Companion downloads/uploads never canceled #3155

mifi opened this issue Sep 1, 2021 · 4 comments
Labels
Bug Companion The auth server (for Instagram, GDrive, etc) and upload proxy (for S3)

Comments

@mifi
Copy link
Contributor

mifi commented Sep 1, 2021

Companion: If the user leaves the uppy upload (closes browser or cancels it), the download seems to keep on going forever until companion has downloaded the whole file to disk. This is not a big issue for small files, but if a user tries many times to upload a 100GB file, it’s gonna quickly fill up the hard drive and starve CPU. There is no method in the Provider API for canceling/aborting downloads, so even if the upload stops, the download will keep on going until finished.

I believe the optimal solution would be that companion server keeps a keep-alive/ping with the client. if the client disappears after X minutes, then cancel the download and the upload

To test this:

  • Start upload of big file
  • Go to dev tools, networking. Set to offline
  • Observe "Upload failed" message, and upload gets canceled
  • In companion, observe that downloads and uploads are still going until they finish

Edit: This may also cover the issue of paused uploads possibly not being garbage collected (if they are paused but never resumed by the user)

Further improvements:

  • Cancel upload also when canceling download (readStream). now it will just eventually time out due to no more data from the readstream
@mifi mifi added Bug Companion The auth server (for Instagram, GDrive, etc) and upload proxy (for S3) Triage labels Sep 1, 2021
@mifi mifi changed the title Companion downloads never canceled Companion downloads/uploads never canceled Sep 1, 2021
@Murderlon
Copy link
Member

Keep in mind that the continuation of the download is expected behavior for certain people. Example: #3128

@mifi
Copy link
Contributor Author

mifi commented Sep 1, 2021

Ok, if that's a feature we're supporting, then maybe the client shouldn't say "upload failed" if it loses connection, but rather resume its connection with companion and continue receiving progress events? Then we just need to make sure that the companion server has a lot of available space (terabytes), or rewrite companion to be stream based so we don't need to store anything on the server #3098

@Murderlon
Copy link
Member

if that's a feature we're supporting, then maybe the client shouldn't say "upload failed" if it loses connection, but rather resume its connection with companion and continue receiving progress events?

That's already the case, right? The client will try to reconnect and it can continue to receive progress in that case. It's important that clients can "fire and forget", they disconnect to do something else and the upload will finish.

@mifi
Copy link
Contributor Author

mifi commented Apr 12, 2024

Hard to test network disconnect locally (because disconnecting wifi would also disconnect the companion upload), but when I did this in the chrome devtools:

queryObjects(WebSocket)

then stored the socket as a global variable, and called temp1.close(), it did automatically reconnect and the upload continued (with progress), so I think we can close this yes.

@mifi mifi closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Companion The auth server (for Instagram, GDrive, etc) and upload proxy (for S3)
Projects
None yet
Development

No branches or pull requests

3 participants