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

Update and test with the latest leveldown #6551

Closed
peakji opened this issue Jun 8, 2017 · 11 comments · Fixed by #6639
Closed

Update and test with the latest leveldown #6551

peakji opened this issue Jun 8, 2017 · 11 comments · Fixed by #6639

Comments

@peakji
Copy link

peakji commented Jun 8, 2017

Issue

We've fixed the bug in leveldown that may cause a crash while closing db with open iterators: Level/leveldown#194 (comment)

However, the Assertion 'dummy_versions_.next_ == &dummy_versions_' failed error can be from anywhere in the C++ land, so I'm not sure if PR Level/leveldown#368 solved the PouchDB case.

It'll be great if you could try with the latest master of leveldown, and ping me if the test still fails.

Info

  • Environment: Node.js
  • Adapter: LevelDB
@hubgit
Copy link

hubgit commented Jun 8, 2017

I can confirm that the Closing db does not cause a crash if changes cancelled test no longer crashes, which is great progress.

Unfortunately the "local" version of the test still doesn't pass (unlike the "http" version of the test, which is fine), as the new "iterator has ended" error that's thrown isn't being caught.

@ralphtheninja
Copy link
Contributor

There's an additional advantage to updating to [email protected] since it uses preubild-install instead of prebuild --install which reduced the dependency tree substantially.

@hubgit Is there anything I can do to help with this? It seems we broke something by fixing something else.

@hubgit
Copy link

hubgit commented Jul 14, 2017

@ralphtheninja this is the test that's still failing - I didn't manage to get to the bottom of how to catch the thrown error appropriately.

@ralphtheninja
Copy link
Contributor

@hubgit What is the command to run all the appropriate tests? Do I need some extra setup with couchdb etc?

@daleharvey
Copy link
Member

npm test will run all the tests, GREP=test.changes.js npm test will run only that file, you do need couchdb running on localhost:5984, if that is too much of a hassle

npm install -g pouchdb-server
pouchdb-server

is an easier version

@ralphtheninja
Copy link
Contributor

@daleharvey Thanks! I'm in the middle of the bush right now and a huge party, but will hop on this when I'm back home :)

@hubgit
Copy link

hubgit commented Jul 22, 2017

Here's what I've been able to surmise so far - this applies only to the test for the local adapter:

The "Closing db does not cause a crash if changes cancelled" test calls db.changes, then asynchronously calls db.close. Closing the database causes db.changes' stream reading to get the new "iterator has ended" error, which is reported by Mocha as an "Uncaught Error". Although the test completes successfully, when done is called the test has already been closed due to the uncaught error, so Mocha throws a "Cannot set property 'state' of undefined" exception, which is reported as an "Unhandled promise rejection".

There must be somewhere in PouchDB's changes/stream reading code to catch the "iterator has ended" error and handle it, but I haven't been able to work out where.

@ralphtheninja
Copy link
Contributor

@hubgit Aye, I've gathered as much myself, but have problems understanding the project structure, since all code is built out before on each npm test. Any pointers greatly appreciated.

@ralphtheninja
Copy link
Contributor

ralphtheninja commented Jul 22, 2017

I basically want to find out what's going on in db.close() to start with. I'm assuming this is a pouchdb specific method which in turn closes an internal leveldown instance.

@vweevers
Copy link

The changestream here doesn't have a listener for an error event. That's where you could catch the iterator had ended error, I think.

@daleharvey
Copy link
Member

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 a pull request may close this issue.

5 participants