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

AsyncIterator _end race condition workaround #125

Merged
merged 1 commit into from
Dec 29, 2020

Conversation

gsvarovsky
Copy link
Contributor

@gsvarovsky gsvarovsky commented Dec 27, 2020

This is a workaround for a race condition in AsyncIterator, which arises during my unit tests, in which _end is called on the LevelIterator twice, asynchronously from:

The outcome in node-quadstore is that the LevelDown AbstractIterator is ended twice, which throws the second time.

I have yet to reproduce this problem either in node-quadstore or in base AsyncIterator.

cc @RubenVerborgh, just in case the cause is obvious.

@RubenVerborgh
Copy link

Is it a problem in AsyncIterator? Then we likely want to fix it over there.

@RubenVerborgh
Copy link

On mobile now, but looks like a problem in this library (and hence your fix seems correct). I believe the _end method should be prepared to be called multiple times; but it’s probably best to document that in AsyncIterator.

@jacoscaz
Copy link
Collaborator

@gsvarovsky looks like your workaround is not a workaround but an actual fix! Thank you for this and thank you @RubenVerborgh for reviewing, I'll merge and release in the next few days!

@jacoscaz jacoscaz merged commit 2f2d555 into quadstorejs:master Dec 29, 2020
@jacoscaz
Copy link
Collaborator

jacoscaz commented Jan 3, 2021

Released in v7.2.1!

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.

3 participants