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

Avoid locking when interacting with the database #150

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

ChrisSchinnerl
Copy link
Member

@ChrisSchinnerl ChrisSchinnerl commented Jan 14, 2025

The issue this solves is the order in which we acquire the mu on the wallet and the locking of the database.

Sometimes we start a db transaction which performs its own locking and then acquire mu and sometimes we acquire mu and then start a db transaction. Which can cause deadlocks for as long as the db transaction hasn't timed out yet.

To fix this the PR refactors the code a bit to make sure we don't hold mu when using the database while allowing to acquire mu when we are already within a db transaction.

UPDATE: This branch was run against the renterd CI which ran in a loop. It seems to have fixed the issue of TestConsensusResync sometimes taking minutes to complete. Instead if consistently finishes in 14-15s.

@ChrisSchinnerl ChrisSchinnerl self-assigned this Jan 14, 2025
@ChrisSchinnerl ChrisSchinnerl marked this pull request as ready for review January 15, 2025 09:39
Copy link
Member

@peterjan peterjan left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@lukechampine lukechampine merged commit dcc73ae into master Jan 15, 2025
10 checks passed
@lukechampine lukechampine deleted the chris/fix-locking branch January 15, 2025 17:36
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.

3 participants