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

Seshat DB error disables search on desktop #14229

Closed
HarHarLinks opened this issue Jun 28, 2020 · 28 comments · Fixed by matrix-org/matrix-react-sdk#5806
Closed

Seshat DB error disables search on desktop #14229

HarHarLinks opened this issue Jun 28, 2020 · 28 comments · Fixed by matrix-org/matrix-react-sdk#5806
Assignees
Labels
A-Indexing Indexing messages via Seshat P2 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect X-Needs-Design

Comments

@HarHarLinks
Copy link
Contributor

Description

Message search
Riot can't securely cache encrypted messages locally while running in a web browser. Use Riot Desktop for encrypted messages to appear in search results.

Message search is disabled although I'm using the riot-desktop app.
This worked when the feature was introduced. I recently enabled labs settings on desktop by adding the respective file %appdata%/Riot/config.json, which is my best guess as to what might have messed things up, although my impression is that it shouldn't have. config.json contents:

{
    "default_server_name": "myserver.url",
    "brand": "some name",
    "features": {
        "feature_font_scaling": "labs",
        "feature_pinning": "labs",
        "feature_custom_status": "labs",
        "feature_custom_tags": "labs",
        "feature_state_counters": "labs",
        "feature_many_integration_managers": "labs",
        "feature_mjolnir": "labs",
        "feature_dm_verification": "labs",
        "feature_bridge_state": "labs",
        "feature_presence_in_room_list": "labs",
        "feature_custom_themes": "labs",
        "feature_new_room_list": "labs",
        "feature_irc_ui": "labs"
    },
    "showLabsSettings": true
}

Steps to reproduce

  • install riot desktop
  • customize config.json

Logs being sent: yes

Version information

  • Platform: desktop

For the desktop app:

  • OS: Windows
  • Version: 1.6.6
@jryans
Copy link
Collaborator

jryans commented Jun 30, 2020

@HarHarLinks If you temporarily move the custom config out of the way to test the default and restart, what behaviour do you see?

@jryans jryans added T-Other Questions, user support, anything else A-Indexing Indexing messages via Seshat and removed T-Defect labels Jun 30, 2020
@HarHarLinks
Copy link
Contributor Author

I renamed the file and restarted. It still displays the same message, nor does search seem to work.

@jryans
Copy link
Collaborator

jryans commented Jul 2, 2020

The log seems to say:

2020-06-28T10:41:26.443Z I EventIndex: Error initializing the event index {"message":"Error opening the database: IndexError(IOError(IOError { path: None, err: Custom { kind: Other, error: \"Invalid MAC\" } }))"}

@poljar, any suggestions on how best to resolve that?

@poljar
Copy link
Contributor

poljar commented Jul 2, 2020

Deleting the EventStore folder is always an option. I wonder what happened to the index files that the MAC doesn't match anymore.

@HarHarLinks
Copy link
Contributor Author

I renamed EventStore temporarily to test this and it works, even with the custom config.json. Would deleting EventStore delete anything other than seshat data, or am I save to do that?
Is there any more info I can provide about this issue?

@poljar
Copy link
Contributor

poljar commented Jul 2, 2020

It only contains Seshat data and it will get rebuilt from the data from the server. Nothing valuable is lost.

A indexer file got somehow corrupted could be by a unclean shutdown, not sure. There's not much to investigate here since we don't have specific logs for this as it's deep in the belly of Seshat. We could offer a better UI for when this happens though.

@cassiersg
Copy link

I had the same issue today, although my case was a bit different: no custom config, but I upgraded from an (about 8 months) old Riot-desktop install. OS: ubuntu 20.04.

Removing the EventStore solved the issue.

@ScottRochford
Copy link

ScottRochford commented Nov 13, 2020

Multiple users in our organisation have had the same problem, including myself. Removing EventStore also fixed it for me.

Currently running Element 1.7.13 with a custom config.json, although I have no idea when the issue appeared.

Another thing I noticed was that before fixing it "Use the Desktop app to search encrypted messages" was displayed under the search field (despite the fact that I'm using the Desktop app), and after applying the workaround that message is gone.

@jryans
Copy link
Collaborator

jryans commented Nov 20, 2020

Another thing I noticed was that before fixing it "Use the Desktop app to search encrypted messages" was displayed under the search field (despite the fact that I'm using the Desktop app), and after applying the workaround that message is gone.

Yes, it's quite confusing that indexing errors currently make the desktop app say "use desktop"... 😖 We have #15168 to track this aspect.

@jryans
Copy link
Collaborator

jryans commented Nov 20, 2020

@poljar What would be a good way to help people here? Maybe a toast that asks permission to delete and rebuild the index...?

@jryans jryans added T-Defect X-Needs-Design P2 S-Major Severely degrades major functionality or product features, with no satisfactory workaround ui/ux and removed T-Other Questions, user support, anything else labels Nov 20, 2020
@poljar
Copy link
Contributor

poljar commented Nov 20, 2020

@poljar What would be a good way to help people here? Maybe a toast that asks permission to delete and rebuild the index...?

Yes that does sound sensible.

@jryans jryans changed the title Search/Seshat disabled on desktop Seshat DB error disables search on desktop Dec 1, 2020
@yajo
Copy link

yajo commented Dec 15, 2020

For whoever comes here, the fix is:

  1. Exit Element with Ctrl+Q
  2. rm -Rf ~/.config/Element/EventStore
  3. Enter Element again.

cc @joao-p-marques

@jryans
Copy link
Collaborator

jryans commented Dec 17, 2020

For those affected by this, does it just happen out of nowhere with seemingly no other changes, or did something else change e.g. you logged in again for the first time in a while...?

@yajo
Copy link

yajo commented Dec 18, 2020

It was a friend, with Element just installed for the 1st time. He tried both flatpak and .deb versions, and the same happened with both.

@jryans
Copy link
Collaborator

jryans commented Dec 18, 2020

Hmm, thanks for the detail. I wonder if there's some race condition in the Seshat init path that is setting things up with e.g. a bad database key or similar...

@MadLittleMods
Copy link
Contributor

Reproduced this installing Element Desktop version 1.7.16 for the first time on macOS 10.15.7. I can also reproduce on Windows 10 (first time install).

Trying to use search -> Use the Desktop app to search encrypted messages

Settings -> Security & Privacy ->Message search

Message search
Element can't securely cache encrypted messages locally while running in a web browser. Use Element Desktop for encrypted messages to appear in search results.

How do I find the logs that show IndexError error mentioned above?


It might have been a coincidence but after starting it manually from the package contents binary in the terminal, search started to work. Before that, I did try restarting the app multiple times from the normal spotlight launcher but was broken each time.

$ /Applications/Element.app/Contents/MacOS/Element
/Users/eric/Library/Application Support/Element exists: yes
/Users/eric/Library/Application Support/Riot exists: no
Starting auto update with base URL: https://packages.riot.im/desktop/update/

Given that I did the same on Windows 10 and didn't fix the problem, I am leaning toward coincidence and race condition.

$ "C:\Users\MLM\AppData\Local\element-desktop\app-1.7.16\Element.exe"
Starting auto update with base URL: https://packages.riot.im/desktop/update/
(node:18016) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

@HarHarLinks
Copy link
Contributor Author

HarHarLinks commented Dec 28, 2020

Happened again, Windows 10 20H2, up to date Element Desktop that had been installed for some time. Deleting EventStore helped.

Edit: and again after less than 2 days.
Additional note: this installation actually dates back to the riot.im days. Appdata -> Element and Element (Riot) folders are nearly empty, so deleted the EventStore from the Riot folder. Also no custom config.json on this one.

@lampholder
Copy link
Member

I experienced this issue, too. Just 'cause it took me a little while to find it, on Windows 10 the folder I needed to remove was located at C:\Users\lamph\AppData\Roaming\Riot Nightly\Event Store

@jaywink
Copy link
Member

jaywink commented Jan 21, 2021

Got hit by this too, Element nightly (Ubuntu) 2021012001

Confusingly, ~/.config has two nightly folders:

Element Nightly/
Element-Nightly/

Element-Nightly seemed to be the right one and deleting EventStore under there got rid of the "use desktop" warning.

Have rageshaked before doing that.

@poljar
Copy link
Contributor

poljar commented Jan 21, 2021

Nightly had an issue which corrupted the db, the issue was caught before it went into a release.

@geckolinux
Copy link

@poljar I've never run Nightly though, only release versions.

@poljar
Copy link
Contributor

poljar commented Jan 21, 2021

Ah sorry, this was a direct comment for @jaywink. The db can get corrupted for other reasons as well.

@geckolinux
Copy link

@poljar Ah ya, gotcha. Well at least for me it still seems to be working fine after I fixed it 4 days ago.

@progserega
Copy link

@progserega Did you also check older names for the directories, such as Riot as well?

I try remove all:

 $ rm -Rf ~/.config/Riot/EventStore
 $ rm -Rf ~/.config/Ele/EventStore
Element/        Element (Riot)/ 
 $ rm -Rf ~/.config/Element/EventStore
 $ rm -Rf ~/.config/Element\ \(Riot\)/EventStore

not help :-(

@cryptid11
Copy link

removing the folder EventStore:
on linux says request failed: CORS request rejected: https://matrix-client.matrix.org/_matrix/client/r0/search
on windows simply doesnt work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Indexing Indexing messages via Seshat P2 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect X-Needs-Design
Projects
None yet