-
Notifications
You must be signed in to change notification settings - Fork 44
#1734 Fix race conditions in the pouchDBCheckpointsPlugin #1741
Conversation
PR is added to the queue for testing as 1. task. (8b10a27) |
Test 102446911 (8b10a27) build started. |
Test (Fail) 102446911 build is completed (8b10a27) See https://github.com/ThaliTester/TestResults/tree/1024469118b10a27__1734_Fix_race_conditions_in_the_pouchDBCheckpointsPlugin_chapko/ for the logs |
PR is added to the queue for testing as 1. task. (cf31575) |
Test 102446911 (cf31575) build started. |
PR is added to the queue for testing as 2. task. (a6c1be7) |
Test 102446911 (a6c1be7) build started. |
Test (Fail) 102446911 build is completed (cf31575) See https://github.com/ThaliTester/TestResults/tree/102446911cf31575__1734_Fix_race_conditions_in_the_pouchDBCheckpointsPlugin_chapko/ for the logs |
Test (Success) 102446911 build is completed (a6c1be7) See https://github.com/ThaliTester/TestResults/tree/102446911a6c1be7__1734_Fix_race_conditions_in_the_pouchDBCheckpointsPlugin_chapko/ for the logs |
Test 102446911a6c1be7(a6c1be7) has failed See https://github.com/ThaliTester/TestResults/tree/102446911a6c1be7__1734_Fix_race_conditions_in_the_pouchDBCheckpointsPlugin_chapko/ for the fail logs |
Please see comments. Reviewed 3 of 3 files at r1. thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 70 at r3 (raw file):
How does this ever get cancelled? If we have stopped Thali isn't this going to just run forever? Seems like a memory leak. thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 74 at r3 (raw file):
Shouldn't we also grab the complete event? It is fired if a live change is cancelled which per my previous comment we should probably be doing. And when it happens shouldn't we call cancel on checkDBSizeThrottled? thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 79 at r3 (raw file):
Shouldn't we call cancel on checkDBSizeThrottled here as well? Comments from Reviewable |
Reviewed 3 of 3 files at r1. Comments from Reviewable |
I think the best course for this PR is to update plugin API a bit to make it possible to unsubscribe from 'checkpoint' events. See comments for details. Review status: all files reviewed at latest revision, 3 unresolved discussions. thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 70 at r3 (raw file): Previously, yaronyg (Yaron Y Goland) wrote…
There is no public API to cancel it manually. All we have is Original spec (#319) suggests My suggestion is to change the API and use thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 74 at r3 (raw file): Previously, yaronyg (Yaron Y Goland) wrote…
Yes, it makes sense. The only thing that bothers me is that 'complete' event might be emitted asynchronously after calling I suggest to manually cancel timer synchronously with thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 79 at r3 (raw file): Previously, yaronyg (Yaron Y Goland) wrote…
Yes, everything from previous comment applies here. Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 70 at r3 (raw file): Previously, chapko (Eugene Chapko) wrote…
It's just weird that this wasn't ever caught by the PouchDB folks. But I guess as long as you don't check changes very often you would probably never even notice the leak. How big a deal do we think this will be in practice for us? thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 74 at r3 (raw file): Previously, chapko (Eugene Chapko) wrote…
Nuke it from orbit, it's the only way to be sure. Agreed, cancel everything. thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 79 at r3 (raw file): Previously, chapko (Eugene Chapko) wrote…
Ditto Comments from Reviewable |
pouchDBCheckpointsPlugin is not used anywhere in Thali, thats why this PR was put on hold for such a long time and we just disabled failing tests. See comments below. Review status: all files reviewed at latest revision, 3 unresolved discussions. thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 70 at r3 (raw file): As far as I know this plugin should fix #499. The only problem is that it is not used anywhere in the Thali. I think it makes more sense to make it a separate module.
Right now the only impact it has is 3 KB wasted to store its source code :) If someone is going to use it with default config, then it most likely will leak one change listener per database. Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. thali/NextGeneration/utils/pouchDBCheckpointsPlugin.js, line 70 at r3 (raw file): Previously, chapko (Eugene Chapko) wrote…
Sorry, as usual, I was confused. :( Comments from Reviewable |
Fixes #1734
This change is