-
Notifications
You must be signed in to change notification settings - Fork 180
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
Opening multiple tabs may prevent proper syncing of channel changes #3992
Comments
@pcenov (cc @radinamatic) could you try to reproduce this? we have limited information, but multiple reports |
@bjester I was able to replicate twice a failure to sync the channel changes by doing the following:
Video: Short.mp4Screenshot: I couldn't spot any relevant errors besides this one at some point:
My guess is that the combination of having multiple tabs open in combination with slow internet connection is causing the issues. See if you can replicate and let me know if you need any additional info. |
I have done specific testing to see if this might be related to the Chrome Energy Saver, and it seems not to be. Activating the energy saver unload for a tab correctly switches syncing to a different tab. |
The energy saver is the same as the memory saver? |
Oh sorry - I tested both, but I did mean memory saver here. |
Shoot. Well I guess @pcenov's reproduction might have clues? I missed his comment here |
Yeah, on first glance it looks like the error is happening if getting the node for resolving a tree insert fails. |
I suspect that this is actually still being caused by a combination of the hidden tab being elected the leader, and Chrome's timer throttling: https://developer.chrome.com/blog/timer-throttling-in-chrome-88/ I noticed this while doing some testing, that the hidden tab did get its timer throttled for a long period of time, while in the other tab I was doing a large amount of editing and uploading. This was noticeable, because I had edited the sync to run from both tabs, and was also forwarding the sync request within a service worker. This meant that in the hidden tab's network tab, I was able to see a long sequence of sync requests forwarded by the service worker, that had come from the active tab, while the hidden tab had not sent any sync requests in that time. |
I am beginning to suspect that Dexie Observable may be susceptible to these issues as well, as it uses timers as a fallback for checking for changes, so we may be getting a double whammy of timer issues, both in responding to Dexie Observable changes and writing to our own changes table, and also in then carrying out the sync to the backend. I think it may be worth while to start the migration away from Dexie Observable, by explicitly writing to our changes table for CREATE, UPDATE, and DELETE in the same way that we do for MOVE, COPY, PUBLISH, etc. The advantage of this approach is that we don't have to worry about multiple writes to our changes table, as we'll be doing it directly in the tab where the change is being made - it will mean that we can't flatten changes as aggressively, but I'm not sure that's too much of an issue currently anyway. That would mean the only thing we are still using Dexie Observable for is the listeners to keep the Vuex state updated - this could then be migrated to using live queries instead, and we could drop Dexie Observable. |
Observed behavior
There have been multiple issue reports that intersect with the syncing of changes from the frontend to the backend:
From the insight we've been able to gather, it seems to involve having Studio open in multiple tabs, similar to #3906. Although, we've received few error reports in Sentry coinciding with these user reports. Some areas for investigation:
DatabaseClosedError
s that we've received a couple times (DatabaseClosedError: DatabaseClosedError Database has been closed #3945)Expected behavior
User-facing consequences
Additional information
https://community.learningequality.org/t/kolibri-studio-not-saving-and-publishing/2745
https://learningequality.slack.com/archives/C0LK8QS9J/p1677873471445029
https://learningequality.slack.com/archives/C0LK8QS9J/p1675989425072409
https://learningequality.slack.com/archives/C0LK8QS9J/p1678811138967969
Usage Details
The text was updated successfully, but these errors were encountered: