Failing test for PouchDB 7.3.0 race condition#3813
Closed
PaulMest wants to merge 1 commit intopubkey:masterfrom
Closed
Failing test for PouchDB 7.3.0 race condition#3813PaulMest wants to merge 1 commit intopubkey:masterfrom
PaulMest wants to merge 1 commit intopubkey:masterfrom
Conversation
simple repro: ``` $ npm install $ npm run test:fast:pouchdb ```
|
@PaulMest Looks like there have race condition when close one of multiple database. When execute db.close, will call pouchdb-adapter-leveldb-core/lib/index.js: api._close = function (callback) {
/* istanbul ignore if */
if (db.isClosed()) {
return callback(pouchdbErrors.createError(pouchdbErrors.NOT_OPEN));
}
db.close(function (err) {
/* istanbul ignore if */
if (err) {
callback(err);
} else {
dbStore.delete(name);
var adapterName = pouchdbUtils.functionName(leveldown);
var adapterStore = dbStores.get(adapterName);
var keys = [...adapterStore.keys()].filter(k => k.includes("-mrview-"));
keys.forEach(key => {
var eventEmitter = adapterStore.get(key);
eventEmitter.removeAllListeners();
eventEmitter.close();
adapterStore.delete(key);
});
callback();
}
});
};The problem happen in below line: var keys = [...adapterStore.keys()].filter(k => k.includes("-mrview-"));So when we close first database, actually will select the second database views... and disconnect it. This cause problem from my point of view. I will submit a PR to pouchdb. |
Owner
|
I am closing this issue here because there is nothing that can be done on the RxDB side. I will reopen when it is fixed on the pouchdb side. |
Contributor
Author
|
apache/pouchdb#8513 has been merged. The fix should be in the next version of PouchDB. |
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.
This PR contains:
Describe the problem you have without this PR
PouchDB 7.3.0 introduced a race condition where two databases open in memory at the same time could cause hanging conditions. This was initially discovered randomly by 2 tests in the test suite. This PR adds a smaller consolidated view of this race condition.
Simple repro:
Todos