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

LL setting state gets corrupted if you have two tabs open? #7432

Closed
ara4n opened this issue Oct 1, 2018 · 13 comments
Closed

LL setting state gets corrupted if you have two tabs open? #7432

ara4n opened this issue Oct 1, 2018 · 13 comments
Assignees
Labels
A-Lazy-Loading P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@ara4n
Copy link
Member

ara4n commented Oct 1, 2018

No description provided.

@michaelkaye
Copy link
Contributor

One was in /develop one was in /app, the develop one had the issue, the app one was fine, refreshing develop informed me it would be 3x smaller memory again, then worked.

@lampholder
Copy link
Member

@michaelkaye was able to reproduce this quite easily by:

  • using /develop to look at a largish room
  • open up a new tab on /app
  • switch back to /develop and see how now everything lazyloady is a little bit wonky (the memberlist panel seems to have lost a bunch of people
  • switch back to /app to see more weirdness no occurring there, too

I wasn't able to reproduce the above myself, though loading /app did seem to retrigger the 'Riot now uses 3 to 5 times less memory' notice when I returned to /develop.

@lampholder lampholder added T-Defect P1 A-Lazy-Loading S-Major Severely degrades major functionality or product features, with no satisfactory workaround labels Oct 2, 2018
@lampholder
Copy link
Member

@bwindels let's chat about this when you get back

@bwindels
Copy link
Contributor

bwindels commented Oct 4, 2018

So, for tabs where one is on /app and the other is on /develop:

/app (LL:off) retriggering the "Upgrade Riot" dialog in /develop (LL:on) is sort of working as designed:

  1. If you would use a non-LL indexeddb/sync state with LL:on, it would probably work but you wouldn't get any of the RAM benefits, so we/I decided to resync in this case.
  2. If you would use a LL indexeddb/sync state with LL:off, you would have missing members everywhere.

What happens in the above scenario is:

  • user opens /develop, resyncs if it hasn't already because LL is now enabled, indexeddb now describes sync state with LL:on
  • user goes to /app, which shares indexeddb with /develop, riot sees indexeddb with LL:on, and resyncs because of reason 2 stated above and afterwards indexeddb describes sync state with LL:off. This resyncing does not show a dialog (it's only shown when enabling LL).
  • now the user goes back to /develop, which finds an indexeddb with LL:off, and resyncs because reason 1.

As the databases are incompatible, some ways to avoid these two deployments from sharing it would be:

  • make them use a different origin (e.g. deploy /develop to develop.riot.im)
  • put url path in indexeddb name

@bwindels bwindels self-assigned this Oct 4, 2018
@bwindels
Copy link
Contributor

bwindels commented Oct 4, 2018

About the missing members on /develop, this should not happen (scenario 1 above) as the LL-riot should happily LL if a room hasn't been marked as already LL'ed in the oob_membership_events object store, even with a non-LL database. Debugging the issue, reading that object store fails because indexeddb can't open a transaction to read that object store:

rageshake.js:66 DOMException: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.
    at https://riot.im/develop/bundles/faf0cae3efaf9039cd16/bundle.js:25140:32
    at LocalIndexedDBStoreBackend.getOutOfBandMembers (https://riot.im/develop/bundles/faf0cae3efaf9039cd16/bundle.js:25139:16)

Persisting the sync state fails in the same way:

Persisting sync data up to  s697247543_570291280_34453_179995053_81909600_482269_11283822_9291958_20815
rageshake.js:66 sync fail: DOMException: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.
    at https://riot.im/develop/bundles/faf0cae3efaf9039cd16/bundle.js:25417:33
From previous event:
    at LocalIndexedDBStoreBackend._persistUserPresenceEvents (https://riot.im/develop/bundles/faf0cae3efaf9039cd16/bundle.js:25416:38)
    at LocalIndexedDBStoreBackend.syncToDatabase (https://riot.im/develop/bundles/faf0cae3efaf9039cd16/bundle.js:25359:45)

I imagine this is because the database got deleted before resyncing by riot/app

@bwindels
Copy link
Contributor

bwindels commented Oct 4, 2018

The only thing I'm still wondering is what

switch back to /app to see more weirdness no occurring there, too

is about. If you haven't refreshed /develop, /app should still have it's database and be happy.
@lampholder any more specifics you can give about that last switch back to /app? /develop was not refreshed, right?

@bwindels
Copy link
Contributor

bwindels commented Oct 4, 2018

Summary

a lazy loading riot on the same origin as a non-lazy-loading riot end up fighting for the database, as they delete it and resync on page load. Deleting the database from under the other riot session's feet causes all sorts of other weirdness (all transactions fail). This is sort of as designed for the reasons stated above, and a fix would be that we namespace the database with the riot path (which could make either riot run out of idb storage double as fast) OR put develop (and staging? experimental?) on a different origin.

If LL were enabled on /app, this problem would be a lot less prominent, which might affect how we want to prioritize this issue. When we decide to do an RC with LL enabled, it would be good to test this scenario between /staging and /develop, to see that using the same database then doesn't give any major issues.

@bwindels
Copy link
Contributor

bwindels commented Oct 4, 2018

Also, some issues seen last week might have been due to the fact that up to Riot 0.16.4 (/app until this Monday) was requesting version 2 of the database and /develop would have upgraded to version 3 (to store the client options, to detect a LL/non-LL database). This will make the store initialization fail, but will still start the client, probably with a lot of weirdness ensuing as all store operations would fail. As of Riot 0.16.5, the database is upgraded to version 3, even when not LL'ing, so this likely not playing a part in the issue reported here.

@ara4n
Copy link
Member Author

ara4n commented Oct 4, 2018

can we not use the same locking that we have already for stopping multiple tabs from corrupting indexeddb for e2e? (or store the settings in local_storage, as indexeddb is probably overkill for simple settings?)

@bwindels
Copy link
Contributor

bwindels commented Oct 4, 2018

Not really, as discussed on matrix, the core of the issue is that while syncing in two tabs, both will overwrite the sync data. This is fine as long as that data is the same, which is only true if the sync filter is the same.

@bwindels
Copy link
Contributor

bwindels commented Oct 5, 2018

@michaelkaye said he wasn't able to reproduce the weirdness on /app anymore (described in the last step of the repro case) but said he was running from a fresh boot as opposed to resuming from sleep when reproing this with Tom.

@bwindels
Copy link
Contributor

bwindels commented Oct 5, 2018

Got the version downgrade dialog working, but switching to a memory store with a LL-disabled client and LL-enabled store is proving difficult, in that it's infinispinnering. Thinking to give up on this last part, and just keep the current behaviour, as it's only a problem until /app has LL enabled.

As an easier to implement solution, we could also show a dialog in the above case with only the option of resyncing, but warning you'll have to close the other tab? As opposed to just resync without any warning as we do now.

@bwindels
Copy link
Contributor

bwindels commented Oct 8, 2018

Went with the dialog, released as part of riot 0.16.6

@bwindels bwindels closed this as completed Oct 8, 2018
su-ex added a commit to SchildiChat/element-web that referenced this issue Jan 17, 2022
* Add permission dropdown for sending reactions ([\element-hq#7492](matrix-org/matrix-react-sdk#7492)). Fixes element-hq#20450.
* Ship maximised widgets and remove feature flag ([\element-hq#7509](matrix-org/matrix-react-sdk#7509)).
* Properly maintain aspect ratio of inline images ([\element-hq#7503](matrix-org/matrix-react-sdk#7503)).
* Add zoom buttons to the location view ([\element-hq#7482](matrix-org/matrix-react-sdk#7482)).
* Remove bubble from around location events ([\element-hq#7459](matrix-org/matrix-react-sdk#7459)). Fixes element-hq#20323.
* Disable "Publish this room" option in invite only rooms ([\element-hq#7441](matrix-org/matrix-react-sdk#7441)). Fixes element-hq#6596. Contributed by @aaronraimist.
* Give secret key field an `id` ([\element-hq#7489](matrix-org/matrix-react-sdk#7489)). Fixes element-hq#20390. Contributed by @SimonBrandner.
* Display a tooltip when you hover over a location ([\element-hq#7472](matrix-org/matrix-react-sdk#7472)).
* Open map in a dialog when it is clicked ([\element-hq#7465](matrix-org/matrix-react-sdk#7465)).
* a11y - wrap notification level radios in fieldsets ([\element-hq#7471](matrix-org/matrix-react-sdk#7471)).
* Wrap inputs in fieldsets in Space visibility settings ([\element-hq#7350](matrix-org/matrix-react-sdk#7350)).
* History based navigation with new right panel store ([\element-hq#7398](matrix-org/matrix-react-sdk#7398)). Fixes element-hq#19686 element-hq#19660 and element-hq#19634.
* Associate room alias warning with public option in settings ([\element-hq#7430](matrix-org/matrix-react-sdk#7430)).
* Disable quick reactions button when no permissions ([\element-hq#7412](matrix-org/matrix-react-sdk#7412)). Fixes element-hq#20270.
* Allow opening a map view in OpenStreetMap ([\element-hq#7428](matrix-org/matrix-react-sdk#7428)).
* Display the user's avatar when they shared their location ([\element-hq#7424](matrix-org/matrix-react-sdk#7424)).
* Remove the Forward and Share buttons for location messages only ([\element-hq#7423](matrix-org/matrix-react-sdk#7423)).
* Add configuration to disable relative date markers in timeline ([\element-hq#7405](matrix-org/matrix-react-sdk#7405)).
* Space preferences for whether or not you see DMs in a Space ([\element-hq#7250](matrix-org/matrix-react-sdk#7250)). Fixes element-hq#19529 and element-hq#19955.
* Have LocalEchoWrapper emit updates so the app can react faster ([\#7358](matrix-org/matrix-react-sdk#7358)). Fixes element-hq#19749.
* Use semantic heading on dialog component ([\element-hq#7383](matrix-org/matrix-react-sdk#7383)).
* Add `/jumptodate` slash command ([\element-hq#7372](matrix-org/matrix-react-sdk#7372)). Fixes element-hq#7677.
* Update room context menu copy ([\element-hq#7361](matrix-org/matrix-react-sdk#7361)). Fixes element-hq#20133.
* Use lazy rendering in the AddExistingToSpaceDialog ([\element-hq#7369](matrix-org/matrix-react-sdk#7369)). Fixes element-hq#18784.
* Tweak FacePile tooltip to include whether or not you are included ([\element-hq#7367](matrix-org/matrix-react-sdk#7367)). Fixes element-hq#17278.
* Ensure group audio-only calls don't switch on the webcam on join ([\element-hq#20234](element-hq#20234)). Fixes element-hq#20212.
* Fix wrongly wrapping code blocks, breaking line numbers ([\element-hq#7507](matrix-org/matrix-react-sdk#7507)). Fixes element-hq#20316.
* Set header buttons to no phase when right panel is closed ([\element-hq#7506](matrix-org/matrix-react-sdk#7506)).
* Fix active Jitsi calls (and other active widgets) not being visible on screen, by showing them in PiP if they are not visible in any other container ([\element-hq#7435](matrix-org/matrix-react-sdk#7435)). Fixes element-hq#15169 and element-hq#20275.
* Fix layout of message bubble preview in settings ([\element-hq#7497](matrix-org/matrix-react-sdk#7497)).
* Prevent mutations of js-sdk owned objects as it breaks accountData ([\element-hq#7504](matrix-org/matrix-react-sdk#7504)). Fixes matrix-org/element-web-rageshakes#7822.
* fallback properly with pluralized strings ([\element-hq#7495](matrix-org/matrix-react-sdk#7495)). Fixes element-hq#20455.
* Consider continuations when resolving whether a tile is last in section ([\element-hq#7461](matrix-org/matrix-react-sdk#7461)). Fixes element-hq#20368 and element-hq#20369.
* Fix read receipts and sent indicators for bubble layout ([\element-hq#7460](matrix-org/matrix-react-sdk#7460)). Fixes element-hq#18298 and element-hq#20345.
* null-guard dataset mxTheme to prevent html exports from exploding ([\element-hq#7493](matrix-org/matrix-react-sdk#7493)). Fixes element-hq#20453.
* Fix avatar container overlapping give feedback cta ([\element-hq#7491](matrix-org/matrix-react-sdk#7491)). Fixes matrix-org/element-web-rageshakes#7987.
* Fix jump to bottom button working when on a permalink ([\element-hq#7494](matrix-org/matrix-react-sdk#7494)). Fixes element-hq#19813.
* Remove the Description from the location picker ([\element-hq#7485](matrix-org/matrix-react-sdk#7485)).
* Fix look of the untrusted device dialog ([\#7487](matrix-org/matrix-react-sdk#7487)). Fixes element-hq#20447. Contributed by @SimonBrandner.
* Hide maximise button in the sticker picker  ([\element-hq#7488](matrix-org/matrix-react-sdk#7488)). Fixes element-hq#20443. Contributed by @SimonBrandner.
* Fix space ordering to match newer spec ([\element-hq#7481](matrix-org/matrix-react-sdk#7481)).
* Fix typing notification colors ([\element-hq#7490](matrix-org/matrix-react-sdk#7490)). Fixes element-hq#20144. Contributed by @SimonBrandner.
* fix fallback for pluralized strings ([\element-hq#7480](matrix-org/matrix-react-sdk#7480)). Fixes element-hq#20426.
* Fix right panel soft crashes chat rooms ([\element-hq#7479](matrix-org/matrix-react-sdk#7479)). Fixes element-hq#20433.
* update yarn.lock and i18n ([\element-hq#7476](matrix-org/matrix-react-sdk#7476)). Fixes element-hq#20426 and element-hq#20423.
* Don't send typing notification when restoring composer draft ([\element-hq#7477](matrix-org/matrix-react-sdk#7477)). Fixes element-hq#20424.
* Fix room joining spinner being incorrect if you change room mid-join ([\element-hq#7473](matrix-org/matrix-react-sdk#7473)).
* Only return the approved widget capabilities instead of accepting all requested capabilities ([\element-hq#7454](matrix-org/matrix-react-sdk#7454)). Contributed by @dhenneke.
* Fix quoting messages from the search view ([\element-hq#7466](matrix-org/matrix-react-sdk#7466)). Fixes element-hq#20353.
* Attribute fallback i18n strings with lang attribute ([\element-hq#7323](matrix-org/matrix-react-sdk#7323)).
* Fix spotlight cmd-k wrongly expanding left panel ([\element-hq#7463](matrix-org/matrix-react-sdk#7463)). Fixes element-hq#20399.
* Fix room_id check when adding user widgets ([\element-hq#7448](matrix-org/matrix-react-sdk#7448)). Fixes element-hq#19382. Contributed by @bink.
* Add new line in settings label ([\element-hq#7451](matrix-org/matrix-react-sdk#7451)). Fixes element-hq#20365.
* Fix handling incoming redactions in EventIndex ([\element-hq#7443](matrix-org/matrix-react-sdk#7443)). Fixes element-hq#19326.
* Fix room alias address isn't checked for validity before being shown as added ([\element-hq#7107](matrix-org/matrix-react-sdk#7107)). Fixes element-hq#19609. Contributed by @Palid.
* Call view accessibility fixes ([\element-hq#7439](matrix-org/matrix-react-sdk#7439)). Fixes element-hq#18516.
* Fix offscreen canvas breaking with split-brained firefox support ([\element-hq#7440](matrix-org/matrix-react-sdk#7440)).
* Removed red shield in forwarding preview. ([\element-hq#7447](matrix-org/matrix-react-sdk#7447)). Contributed by @ankur12-1610.
* Wrap status message ([\element-hq#7325](matrix-org/matrix-react-sdk#7325)). Fixes element-hq#20092. Contributed by @SimonBrandner.
* Move hideSender logic into state so it causes re-render ([\element-hq#7413](matrix-org/matrix-react-sdk#7413)). Fixes element-hq#18448.
* Fix dialpad positioning ([\element-hq#7446](matrix-org/matrix-react-sdk#7446)). Fixes element-hq#20175. Contributed by @SimonBrandner.
* Hide non-functional list options on Suggested sublist ([\element-hq#7410](matrix-org/matrix-react-sdk#7410)). Fixes element-hq#20252.
* Fix width overflow in mini composer overflow menu ([\element-hq#7411](matrix-org/matrix-react-sdk#7411)). Fixes element-hq#20263.
* Fix being wrongly sent to Home space when creating/joining/leaving rooms ([\element-hq#7418](matrix-org/matrix-react-sdk#7418)). Fixes matrix-org/element-web-rageshakes#7331 element-hq#20246 and element-hq#20240.
* Fix HTML Export where the data-mx-theme is `Light` not `light` ([\element-hq#7415](matrix-org/matrix-react-sdk#7415)).
* Don't disable username/password fields whilst doing wk-lookup ([\element-hq#7438](matrix-org/matrix-react-sdk#7438)). Fixes element-hq#20121.
* Prevent keyboard propagation out of context menus ([\element-hq#7437](matrix-org/matrix-react-sdk#7437)). Fixes element-hq#20317.
* Fix nulls leaking into geo urls ([\element-hq#7433](matrix-org/matrix-react-sdk#7433)).
* Fix zIndex of peristent apps in miniMode ([\element-hq#7429](matrix-org/matrix-react-sdk#7429)).
* Space panel should watch spaces for space name changes ([\element-hq#7432](matrix-org/matrix-react-sdk#7432)).
* Fix list formatting alternating on edit ([\element-hq#7422](matrix-org/matrix-react-sdk#7422)). Fixes element-hq#20073. Contributed by @renancleyson-dev.
* Don't show `Testing small changes` without UIFeature.Feedback ([\element-hq#7427](matrix-org/matrix-react-sdk#7427)). Fixes element-hq#20298.
* Fix invisible toggle space panel button ([\element-hq#7426](matrix-org/matrix-react-sdk#7426)). Fixes element-hq#20279.
* Fix legacy breadcrumbs wrongly showing up ([\element-hq#7425](matrix-org/matrix-react-sdk#7425)).
* Space Panel use SettingsStore instead of SpaceStore as source of truth ([\element-hq#7404](matrix-org/matrix-react-sdk#7404)). Fixes element-hq#20250.
* Fix inline code block nowrap issue ([\element-hq#7406](matrix-org/matrix-react-sdk#7406)).
* Fix notification badge for All Rooms space ([\element-hq#7401](matrix-org/matrix-react-sdk#7401)). Fixes element-hq#20229.
* Show error if could not load space hierarchy ([\element-hq#7399](matrix-org/matrix-react-sdk#7399)). Fixes element-hq#20221.
* Increase gap between ELS and the subsequent event to prevent overlap ([\element-hq#7391](matrix-org/matrix-react-sdk#7391)). Fixes element-hq#18319.
* Fix list of members in space preview ([\element-hq#7356](matrix-org/matrix-react-sdk#7356)). Fixes element-hq#19781.
* Fix sizing of e2e shield in bubble layout ([\element-hq#7394](matrix-org/matrix-react-sdk#7394)). Fixes element-hq#19090.
* Fix bubble radius wrong when followed by a state event from same user ([\element-hq#7393](matrix-org/matrix-react-sdk#7393)). Fixes element-hq#18982.
* Fix alignment between ELS and Events in bubble layout ([\element-hq#7392](matrix-org/matrix-react-sdk#7392)). Fixes element-hq#19652 and element-hq#19057.
* Don't include the accuracy parameter in location events if accuracy could not be determined. ([\element-hq#7375](matrix-org/matrix-react-sdk#7375)).
* Make compact layout only apply to Modern layout ([\element-hq#7382](matrix-org/matrix-react-sdk#7382)). Fixes element-hq#18412.
* Pin qrcode to fix e2e verification bug ([\element-hq#7378](matrix-org/matrix-react-sdk#7378)). Fixes element-hq#20188.
* Add internationalisation to progress strings in room export dialog ([\element-hq#7385](matrix-org/matrix-react-sdk#7385)). Fixes element-hq#20208.
* Prevent escape to cancel edit from also scrolling to bottom ([\element-hq#7380](matrix-org/matrix-react-sdk#7380)). Fixes element-hq#20182.
* Fix narrow mode composer buttons for polls labs ([\element-hq#7386](matrix-org/matrix-react-sdk#7386)). Fixes element-hq#20067.
* Fix useUserStatusMessage exploding on unknown user ([\element-hq#7365](matrix-org/matrix-react-sdk#7365)).
* Fix room join spinner in room list header ([\element-hq#7364](matrix-org/matrix-react-sdk#7364)). Fixes element-hq#20139.
* Fix room search sometimes not opening spotlight ([\element-hq#7363](matrix-org/matrix-react-sdk#7363)). Fixes matrix-org/element-web-rageshakes#7288.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Lazy-Loading P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

No branches or pull requests

4 participants