-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 IAVL Iterator Race Condition #5279
Conversation
func (iter *iavlIterator) Close() { | ||
close(iter.quitCh) | ||
// wait iterCh to close | ||
for range iter.iterCh { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment in the original issue. I believe we can alternatively wait on a done channel that gets sent during iterateRoutine()
. But I think this will also suffice.
In addition, not sure how to best test this as I imagine we'll need a large tree to have iterateRoutine
still run after we call Close()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use go test -race in unit test may make this bug happen. But it does not always happen.
Codecov Report
@@ Coverage Diff @@
## master #5279 +/- ##
==========================================
- Coverage 53.5% 53.49% -0.01%
==========================================
Files 290 290
Lines 17770 17771 +1
==========================================
Hits 9507 9507
Misses 7513 7513
- Partials 750 751 +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
closes: #5276
credit: @wangkui0508 🎉
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added a relevant changelog entry to the
Unreleased
section inCHANGELOG.md
Re-reviewed
Files changed
in the github PR explorerFor Admin Use: