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: limit scope of stacks_rw_db usage to free lock #543

Merged
merged 2 commits into from Apr 2, 2024

Conversation

MicaiahReid
Copy link
Collaborator

@MicaiahReid MicaiahReid commented Mar 29, 2024

Every 32 stacks blocks, Chainhook attempts to check for a new archive file to fix any potential holes in the database. This process requires readwrite access to the stacks.rocksdb. However, the process that called this subprocess already had a readwrite instance of the database open, which was preventing the lock from being cleared.

This PR sets the scope of the initial usage of the db in order to free up the lock.

Fixes #518

Copy link
Contributor

@csgui csgui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, I thought the code could be simplified. However, upon closer inspection, I noticed that the data struct differs between StacksChainEvent::ChainUpdatedWithBlocks and StacksChainEvent::ChainUpdatedWithReorg. As a result, a more effective code reorganization is possible, but it would require deeper changes that are beyond the scope of this pull request.

Code LGTM, just a small change on the error message.

@MicaiahReid MicaiahReid requested a review from csgui April 2, 2024 14:44
@MicaiahReid MicaiahReid merged commit 7407843 into develop Apr 2, 2024
4 of 6 checks passed
@MicaiahReid MicaiahReid deleted the fix-db-reingest branch April 2, 2024 15:42
MicaiahReid added a commit that referenced this pull request Apr 2, 2024
Every 32 stacks blocks, Chainhook attempts to check for a new archive
file to fix any potential holes in the database. This process requires
readwrite access to the stacks.rocksdb. However, the process that called
this subprocess already had a readwrite instance of the database open,
which was preventing the lock from being cleared.

This PR sets the scope of the initial usage of the db in order to free
up the lock.
github-actions bot pushed a commit that referenced this pull request Apr 2, 2024
## [1.4.1](v1.4.0...v1.4.1) (2024-04-02)

### Bug Fixes

* limit scope of stacks_rw_db usage to free lock ([#543](#543)) ([0c287ca](0c287ca))
* resolve dependencies ([#548](#548)) ([86334f4](86334f4))
* return unsupported kind for PoisonMicroblock ([#545](#545)) ([123ec9d](123ec9d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

investigate snapshot ingestion
2 participants