question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Race condition saving files to S3

See original GitHub issue

When saving using tus-node-server with the S3 backend the meta data gets saved in a .info file its metadata. This file also gets used to reply to a HEAD request which uppy uses to determine if an upload succeeded (which it does after a PATCH resulted in 502?). So there is a race condition where tus-node-server actually failed in saving the file (hence the 502) but the HEAD call returns that there is a file since tus-node-server only check the meta .info file.

Any idea how to solve this? Would an extra call to S3 to check if the main file also exists be a solution?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DJWassinkcommented, May 10, 2019

Hey, thanks for pointing me to tusd, will certainly have another look at it (gotta sharpen my go skill haha). Anyway the main issue is the ‘Complete Multipart Upload’ no being called correctly after an upload is done. I tried a few different options but couldn’t solve it reliably. I hope I can get tusd running, cheers!

1reaction
Acconutcommented, May 10, 2019

As far as I know, tus-node-server has little protection against concurrent access which can result in these race conditions as you mentioned. I also don’t know how to solve this but we’re happy to accept a PR if you could supply one.

Alternatively, I would recommend you to consider using another tus server (such as the more mature https://github.com/tus/tusd) as we tus-node-server is in a bad shape right now (see https://github.com/tus/tus-node-server/blob/master/README.md).

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS S3 client race condition solutions - Stack Overflow
The issue arises as a race condition when each client is attempting to download the same file within the aforementioned s3 bucket.
Read more >
Race Condition that could Result to RCE - InfoSec Write-ups
Race Condition that could Result to RCE - (A story with an App that temporary stored an uploaded file within 2 seconds before...
Read more >
Race condition when you don't even know you're racing
Our first reaction was to verify our own archive: the S3 object we had was correct, data valid, and indeed their checksum didn't...
Read more >
Understanding and Handling Race Conditions at DynamoDB
What are Race Conditions? · we're saving votes per candidate in a list at a DynamoDB document. · a Lambda function behind an...
Read more >
Storing, Retrieving & Implementing Objects using AWS S3
You can think of S3 as a virtual cloud drive where you can create folders (buckets) to store data files (objects) and specify...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found