Skip to content

Conversation

@dboehm-avalabs
Copy link
Contributor

CommitToParent can happen concurrently so it may cause the parent of a view to change during its own attempt to commit to its parent(see the new unit tests). This isn't an issue for CommitToDB as it uses the commit lock.

@dboehm-avalabs dboehm-avalabs changed the base branch from master to dev April 11, 2023 14:44

// ensure that the view under this one is up-to-date before potentially pulling in nodes from it
// getting the Merkle root forces any unupdated nodes to recalculate their ids
if t.parentTrie != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

detects as race and no longer needed. Hold over from when views could have no parent view.

t.db.commitLock.Lock()
defer t.db.commitLock.Unlock()
}
t.db.commitLock.Lock()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prevents multiple commits from occurring at the same time until I can figure out a way to manage the safety of this.

@danlaine danlaine merged commit 9cf116b into dev Apr 11, 2023
@danlaine danlaine deleted the FixCommitToParentBug branch April 11, 2023 19:33
abi87 pushed a commit that referenced this pull request Apr 13, 2023
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 this pull request may close these issues.

4 participants