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

Fix race condition in sha256 calculation #1164

Merged
merged 3 commits into from
Jul 7, 2022

Conversation

mvandenburgh
Copy link
Member

Waits until the current transaction is commited before running asset validation.

As part of the asset validation process, the sha256 checksum is injected into the metadata. The recent changes to delay asset validation to a new task after checksumming means that there is a good chance it will run before the sha256 checksum has been commited to the database. This PR uses the transaction.on_commit hook to avoid this. I also made a small memory optimization by changing a queryset.values to a queryset.values_list.

Fixes #1156

Waits until the current transaction is commited before running asset validation. This fixes the race condition where asset validation occurs before the newly calculated sha256 checksum is commited to the DB
@mvandenburgh mvandenburgh added patch Increment the patch version when merged release Create a release when this pr is merged labels Jul 6, 2022
@mvandenburgh mvandenburgh merged commit 097f1c0 into master Jul 7, 2022
@mvandenburgh mvandenburgh deleted the fix-sha256-checksum-race-condition branch July 7, 2022 14:35
@dandibot
Copy link
Member

dandibot commented Jul 7, 2022

🚀 PR was released in v0.2.33 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some checksums aren't committing in time
4 participants