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

Riot fails in strange ways when indexeddb is full #6120

Closed
turt2live opened this issue Feb 11, 2018 · 8 comments
Closed

Riot fails in strange ways when indexeddb is full #6120

turt2live opened this issue Feb 11, 2018 · 8 comments
Labels
A-Storage Storage layer of the app, including IndexedDB, local storage, etc. P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@turt2live
Copy link
Member

Description

image

This has lead to all kinds of fun problems:

image

Riot should probably fail a bit more gracefully. I didn't realize my storage was full until I went to start a report about encryption being disabled and happened to consider the case of indexeddb being full. The app runs fine otherwise - messages can be sent and received, features work, etc. The only problems are those described above.

Version information

  • Platform: web (in-browser)
  • Browser: Chrome 64
  • OS: Windows 10
  • URL: riot.im/develop
@turt2live
Copy link
Member Author

For those that may be running into this, clean up your primary drive. Chrome, for example, sets the maximum quota to ~6% of your available free space.

@lampholder lampholder added T-Defect P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround labels Feb 14, 2018
@lampholder
Copy link
Member

As per #6125 (which I'm going to close as a dup) we need to warn loudly when this happens as a bare minimum. It would be nice also to tell people what they can do to address the problem (and ultimately even nicer make it so they don't encounter this problem by effectively managing the size of indexeddb.

@lampholder lampholder added this to the 0.14 milestone Feb 14, 2018
@lukebarnard1
Copy link
Contributor

lukebarnard1 commented Feb 27, 2018

A useful resource is Offline Storage for Progressive Web Apps, where it compares browsers and their quotas:

Browser Limit
Chrome <6% of free space
Firefox <10% of free space
Safari <50MB
IE10 <250MB
Edge Dependent on volume size

Browsers do different things in response to the limit being exceeded:

Firefox

In Firefox, apps can use up to 10% of free disk space, but will prompt the user for further storage requests after 50MB data stored.

If the user denies expansion above 50MB, QuotaExceededError is thrown and could be used to show a dialog that says something like "Riot has exceeded your browser's quota limits".

When quotas are exceeded (or the user denies expansion), data is evicted:

Browser Eviction Policy
Chrome LRU once Chrome runs out of space
Firefox LRU if the whole disk gets full
Safari No eviction
Edge No eviction

Chrome

In @turt2live's case, Chrome probably evicted the riot.im origin, removing all data at once from under the app.

Solution

We will need to move over to a different storage API: Storage. This will allow us to:

  1. request "persistent" instead of "best-effort" storage, that won't be removed without the user's consent;
  2. request an estimate of the usage and quota for the app.

We can use 1. to prevent the data disappearing underneath the app without the user's consent. We can use 2. to periodically indicate to the user that storage is low.

@lukebarnard1 lukebarnard1 removed this from the 0.14 milestone Feb 28, 2018
@turt2live
Copy link
Member Author

Today's failure mode was silently failing to sync. Took nearly 3 hours before I realized that my client wasn't syncing.

@grahamperrin
Copy link

grahamperrin commented Apr 7, 2018

Thanks,

… We will need to move over to a different storage API: Storage. …

Is a future move – to Storage Standard – certain?

@hrj
Copy link

hrj commented Sep 29, 2018

E2E has suddenly stopped working for me since yesterday.

Unable to decrypt: The sender's device has not sent us the keys for this message. 

There was no change in browser versions or anything else on my system, but the free space on my disk did change drastically yesterday. So it is probably related to this issue.

To reclaim space, which tables of the Local storage / Indexed DB can we delete safely? I don't want to lose my device keys for sure. I assume log entries can be deleted without affecting functionality.

@ara4n
Copy link
Member

ara4n commented Sep 29, 2018

can you rageshake so we can see whether the issue actually is indexeddb filling up? the error you've quoted there could be related to other issues (e.g. failing to upload one-time keys to your server or something).

the safest bet is to export your E2E keys via settings, and then either relogin to entirely flush the storage, or you could experiment with manually deleting the logs and matrix-js-sdk:riot-web-sync tables from indexeddb. Not sure how gracefully the app would recover from the tables from disappearing under it, though, and the chances are relatively high that it will just panic and re-login.

@jryans
Copy link
Collaborator

jryans commented Apr 2, 2019

#9220 tracks this problem as a meta-issue of several separate tasks. We have now implemented some of the ideas here and tracked the remaining ones in new issues, so I think we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Storage Storage layer of the app, including IndexedDB, local storage, etc. 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

7 participants