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

Call zip_read() from within the txhashet lock for a consistent view on the files #3142

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

antiochp
Copy link
Member

We were taking a lock on the txhashet, rewinding and taking a snapshot (saving leafset to disk for specific header hash). Then releasing the txhashet lock and the copying the files and building the zip.

I do not see exactly how this could cause a corrupt txhashset.zip but it does risk all kinds of weird edge cases where we sync the txhashset files to disk (say from another thread processing a new block) in the period between releasing the lock and creating the zip.

This PR moves the txhashset::zip_read() call to inside the txhashet lock.

Also added some logging to get an idea of when we create new zip files and when we reuse a previously created zip file.

@antiochp antiochp merged commit e2795b1 into mimblewimble:master Nov 26, 2019
@antiochp antiochp deleted the zip_read_lock branch November 26, 2019 21:17
@antiochp antiochp added this to the 3.0.0 milestone Dec 11, 2019
@antiochp antiochp mentioned this pull request Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants