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

[BUG] Possible race condition when deleting a bucket while an object is being uploaded #588

Open
0xavi0 opened this issue Jun 15, 2023 · 2 comments
Labels
kind/bug Something isn't working triage/next-candidate This could be moved to the next milestone

Comments

@0xavi0
Copy link
Contributor

0xavi0 commented Jun 15, 2023

Describe the bug A clear and concise description of what the bug is.

We could have issues when deleting a bucket concurrently with an object upload.

To Reproduce Steps to reproduce the behavior:

Thread 1 starts a big file upload (creates a version with state=OPEN)
Thread 2 deletes the bucket in which the object of Thread1 lives
Thread 3 Garbage collector kicks in, and deletes the bucket permanently (plus objects and versions, including the one that was OPEN)
Thread 1 finished the file upload and wants to change the state of its version from OPEN to COMMITTED, but the version no longer exists.

Expected behavior A clear and concise description of what you expected to
happen.

When the thread uploading the file is done... it should return an error so the upload is retried and then will return a Bucket does not exist error.

We discussed this and the proposed solution was:

When deleting the bucket we also update the database and set all versions that are in state=OPEN to state=DELETED (in a transaction)

When the thread uploading the file finishes it tries upload the versions with the version id corresponding to the version it is uploading and WHERE state=OPEN.
It won't update any row if the bucket was deleted (because the state was changed to DELETED in the previous step) and we can return an internal error.

@0xavi0 0xavi0 added the kind/bug Something isn't working label Jun 15, 2023
@0xavi0 0xavi0 added this to the v0.18.0 milestone Jun 15, 2023
@github-actions github-actions bot added the triage/waiting Waiting for triage label Jun 15, 2023
@0xavi0 0xavi0 changed the title [BUG] Possible race condition when deleting a bucket while an object is being pushed [BUG] Possible race condition when deleting a bucket while an object is being uploaded Jun 15, 2023
@jhmarina jhmarina removed this from the v0.18.0 milestone Jul 4, 2023
@jhmarina jhmarina added triage/next-candidate This could be moved to the next milestone and removed triage/waiting Waiting for triage labels Jul 4, 2023
@jhmarina
Copy link
Contributor

jhmarina commented Sep 7, 2023

This may have been implemented already. Xavi will have a look at it

@0xavi0
Copy link
Contributor Author

0xavi0 commented Sep 8, 2023

This is not implemented yet.
As it's a theoretical error case I'm going to set priority 2.

@0xavi0 0xavi0 added the priority/2 To be prioritized according to impact label Sep 8, 2023
@jecluis jecluis removed the priority/2 To be prioritized according to impact label Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/next-candidate This could be moved to the next milestone
Projects
Status: Backlog
Development

No branches or pull requests

3 participants