Repository navigation
Fix LMDB NIP-45 COUNT pegging a core - #139
Open
shawnyeager wants to merge 6 commits into
Open
shawnyeager wants to merge 6 commits into
shawnyeager wants to merge 6 commits into
Conversation
Vendor eventstore v0.17.5 plus the cursor fix from fiatjaf/eventstore#78 and point Haven at it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eventstore v0.17.5 CountEvents and CountEventsHLL increment the LMDB counter and then loop without calling it.next(). A NIP-45 COUNT that matches at least one event stays on that row forever, on a goroutine that ignores context, and pegs one core until the process restarts. Extra author, kind, and tag checks also run when prepareQueries left those slices nil, so some mixed filters return 0.
fiatjaf/eventstore#78 fixes both, and it is not in a tag. The LMDB sources are unchanged from v0.17.5 through v0.17.14, so this vendors v0.17.5 plus that cursor fix at third_party/eventstore and replaces the module with it. Existing LMDB databases stay compatible. Websocket COUNT calls db.CountEvents and gets the fixed counter. The admin console still walks when backendCountsSafely is false, so dropping the replace later cannot hang the console.
third_party/eventstore tests: go test -timeout 60s ./lmdb/ -run TestCountAdvancesPastMatches. Haven: go test -timeout 180s -run 'TestCountStoredEventsTerminatesOnEveryBackend|TestBackendCountsSafelyKnowsAboutLmdb'.
The branch commits are split because of upload size. Squash is appropriate. Remove third_party/eventstore and the replace once #78 is tagged.