element-web icon indicating copy to clipboard operation
element-web copied to clipboard

Desktop client loses keys when disk is full

Open drue opened this issue 7 years ago • 15 comments

Description

I ran out of disk space and I believe I rebooted in a disk full condition in order to lose swap files. After reboot, I get vector-im/element-web#2996. I'm not sure if vector-im/element-web#3660 is related or if desktop uses a real file API where you can avoid writing to a file when there is no disk space.

Version information

  • OSX Desktop 0.9.9

drue avatar May 24 '17 16:05 drue

We currently use the localStorage API to store key data; we're about to switch to indexeddb though. Both will likely fail if your disk fills however (although it shouldn't corrupt entirely, it's up to Chromium rather than us). However, once vector-im/element-meta#647 you should at least be able to re-request the missing keys from other devices (including the sender).

ara4n avatar May 24 '17 20:05 ara4n

So I guess the same would happen in a browser?

t3chguy avatar May 25 '17 15:05 t3chguy

Browser behaviour is to stop accepting new keys because it can't, leading to future messages being unable to decrypt. I've run into this failure mode many times on riot-web.

turt2live avatar May 25 '17 15:05 turt2live

@turt2live so vector-im/element-web#2996?

t3chguy avatar May 25 '17 15:05 t3chguy

yes, but I'm not sure how desktop behaves, or how the browser behaves when your disk is full tbh.

turt2live avatar May 25 '17 15:05 turt2live

Assigning a high severity and a low priority to reflect that this is highly disruptive but should be solved by vector-im/element-meta#647 (rather than taking specific steps to handle diskfill)

lampholder avatar May 30 '17 09:05 lampholder

I'm tired of waking up to "* Unable to decrypt: InvalidStateError: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing. **" which means I have to quit Riot, delete all of Riot's files, launch and login again, and ask everyone to resend the messages I missed. Riot taunts me with "Re-request encryption keys from your other devices." but that doesn't work because I don't have another device.

I use my computer and sometimes it runs out of disk space. You have to deal with it. If you are using a broken library you have to patch it or find something else. Nobody cares if Chrome is broken or whatever. All they think is "Riot is shit and so is my friend for convincing me to use it." So I can't recommend Riot to anyone at least until you fix this.

drue avatar May 05 '18 14:05 drue

For future reference and in hopes that it will be useful to others, here is how I got rid of this problem:

  1. Clear up some space in your home directory (which in all likelihood is on the filesystem that is running out of space)
  2. Quit Riot: 1.. If running as a standalone app, close the app 2.. If running as a browser tab, close the browser
  3. Restart Riot 1.. Sart the standalone Riot app, or 2.. Start your browser

My encrypted conversations were all back to normal.

axelsimon avatar Nov 26 '18 10:11 axelsimon

Furthermore, would it be possible to show something friendlier to users, to help them? The current message is pretty horrible (you can't read your correspondant's messages, which is bad and stressful and makes you wonder if you've done something wrong, and on top of that the message is super technical/jargon-y).

Can I suggest:

Sorry, there is no disk space left on your device, because of this Riot couldn't store the secret keys needed to decrypt the message. Please make some space by deleting some data and restart Riot.

axelsimon avatar Nov 26 '18 16:11 axelsimon

this should now be alleviated on the Desktop app and Firefox where we get Persistent Storage permissions, in Chrome it may/may not get the permissions.

t3chguy avatar Apr 11 '20 23:04 t3chguy

This just happened to me on the desktop app and unfortunately, nothing is improved compared to the situation described several years ago.

The exact same message is still the one shown:

Unable to decrypt: InvalidStateError: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing

That message should really be changed to something understandable by someone who doesn't have a PhD in databaseology. How problematic would it be to just replace the current error message with the one i suggested in November 2018? Can there be another cause but lack of disk space for throwing "Unable to decrypt: InvalidStateError: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing"?

axelsimon avatar May 15 '20 10:05 axelsimon

I'll just add to the issue that it just occured to me. My disk got full and somebody I couldn't receive or send encrypted messages on Riot afterward, previous messages showed the same failed transaction message.

I didn't troubleshoot much. I restarted Riot and had access to the previous messages but couldn't send any. I just started a new encrypted room since it was a new server.

jpeg2600 avatar Jun 21 '20 20:06 jpeg2600

@ara4n what prompted the change from P1to P3?

As it may not be clear: Element-desktop will still effectively fatally wipe existing local data/keys/history in the event of storage shortage. It seems prudent to me to prioritize doing what's possible to prevent this for keys, at least, maybe by taking another look at storage API guarantees.

3nprob avatar Jul 09 '22 01:07 3nprob

@3nprob you are reading that backwards. It went from P3 to P1.

(the P labels are not really used anymore, the S-Critical is the important one)

aaronraimist avatar Jul 09 '22 01:07 aaronraimist

@aaronraimist sorry for the noise, my bad, should not comment before coffee.

3nprob avatar Jul 09 '22 01:07 3nprob

this sounds like a duplicate of #14174 (which is more recent, but has a clearer description of the symptoms), unless anyone can clarify the difference?

richvdh avatar Mar 15 '23 15:03 richvdh

Duplicate of #14174

richvdh avatar Mar 16 '23 16:03 richvdh