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

Possible data corruption and data loss since 2.0 #2544

Closed
fsateler opened this issue Mar 17, 2021 · 0 comments
Closed

Possible data corruption and data loss since 2.0 #2544

fsateler opened this issue Mar 17, 2021 · 0 comments

Comments

@fsateler
Copy link
Contributor

Pull request #2209, by storing files in after_commit callback instead of after_save, inadvertently introduces possible data corruption and data loss:

  • Uploader state is inconsistent between save and commit. For example, reading my_object.file_url.url will return a bogus url if I read before commit.
  • A file might not be uploaded after a successful commit. For example, if there is a network failure. This causes the transaction to not be rolled back and invalid records being recorded.
  • Even if the upload eventually completes, it can take an arbitrary amount of time, during which the record is invalid.
fsateler added a commit to fsateler/carrierwave that referenced this issue Mar 17, 2021
This commit attempts to fix leftover files in failed transactions, but
in the process introduces three problems:

- Uploader state is inconsistent between `save` and `commit`. For example, reading `my_object.file_url.url` will return a bogus url if I read before commit.
- A file might not be uploaded after a successful commit. For example, if there is a network failure. This causes the transaction to not be rolled back and invalid records being recorded.
- Even if the upload eventually completes, it can take an arbitrary amount of time, during which the record is invalid.

This reverts commit 665f225.

Fixes: carrierwaveuploader#2544
krasnoukhov pushed a commit to simplepractice/carrierwave that referenced this issue Oct 4, 2022
This commit attempts to fix leftover files in failed transactions, but
in the process introduces three problems:

- Uploader state is inconsistent between `save` and `commit`. For example, reading `my_object.file_url.url` will return a bogus url if I read before commit.
- A file might not be uploaded after a successful commit. For example, if there is a network failure. This causes the transaction to not be rolled back and invalid records being recorded.
- Even if the upload eventually completes, it can take an arbitrary amount of time, during which the record is invalid.

This reverts commit 665f225.

Fixes: carrierwaveuploader#2544
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant