element-hq / element-desktop

A glossy Matrix collaboration client for desktop.
https://element.io
GNU Affero General Public License v3.0
1.14k stars 261 forks source link

Ubuntu/Gnome, after fresh boot (with element starting), application shortcut launches new, not open existing #679

Open BloodyIron opened 2 years ago

BloodyIron commented 2 years ago

Steps to reproduce

  1. Reboot (or equivalent)
  2. Click on "Element" shortcut on application side-bar
  3. Second instance of Element launches, instead of "restoring" the Element that started with boot (that is minimised by default)

Outcome

What did you expect?

I expect the existing Element to launch, instead of a second instance

What happened instead?

A second instance launched, and it of course asked for my login credentials (since this is a second instance)

Operating system

Ubuntu 20.04

Application version

Element version: 1.10.6 Olm version: 3.2.8

How did you install the app?

From the Element repo, as per the main website set up steps

Homeserver

Default matrix server, public

Will you send logs?

No

BloodyIron commented 2 years ago

This issue seemed to start in the last... week or so? So a recent regression.

When I quit the instance of Element that was launched at boot, then minimise it, then do the application shortcut, THAT time it restores the application, instead of creating a second instance of Element. So this looks to be centric to the boot process somehow...

andybalaam commented 2 years ago

For the record, using today's Element Nightly, on Ubuntu MATE 21.10, this does not happen for me, so it may be specific to GNOME.

BloodyIron commented 2 years ago

I am still having this issue as of today. It happens after every boot, without exception. And I do update my Element regularly when it hits the repos.

Also, did all the Element issues get merged into element-web?

BloodyIron commented 2 years ago

I am still having this issue. Ubuntu 20.04, GNOME 3.36.8

BloodyIron commented 2 years ago

I'd also like to point out this creates session problems, because the second Element instance wants me to log back in again. This is a problem when I authorise all my Element instances to decrypt my stuff securely.

This does NOT happen occasionally @gsouquet , this happens EVERY TIME. Can we please have this bumped up?

BloodyIron commented 2 years ago

Okay this actually broke a profile on one of my desktops and now I have to completely rebuild that profile. THIS IS A PROBLEM.

BloodyIron commented 2 years ago

When I run "element-desktop" at the CLI after a fresh boot, since Element is already running, it fails to detect the existing process, and a second one is spawned, error output in the screenshot, and this is what the UX is like: Screenshot-20220808183027-2400x866

BloodyIron commented 1 year ago

Okay so today something about my Element session got corrupted, and I had to re-login. So I took this as an opportunity to wipe Element Desktop completely off this computer to see if this issue persisted. And the issue persists.

I purged (apt purge) element and riot (since I've been using it so long it used to be Riot).

I also searched my entire root, recursively, for anything element/Element/riot/Riot related and deleted any folders/files that looked related to the chat app.

I removed the repo.

I then re-added the repo, following the download instructions on the current page (as of this writing), adding the repo, apt update, install app, etc.

Login, validate session, etc.

Reboot...

It starts at boot, but if I click on the application shortcut in the side-bar for Element, it starts a SECOND session (asking me to login) instead of just maximising the Element-Desktop that's already running (in the system tray, etec).

So... this issue STILL EXISTS and I cannot find any evidence this is due to untidy configuration.

Currently on Ubuntu 20.04.

BloodyIron commented 1 year ago

So I have a fresh install of Ubuntu and this issue is STILL happening! Now rocking Ubuntu 22.04 LTS.

Installing Element via apt repo.

This is strictly related to the autostart instance of Element

BloodyIron commented 1 year ago

@t3chguy any chance we can have this issue re-evaluated for priority/tagging please?

t3chguy commented 1 year ago

@BloodyIron it doesn't seem very widespread, has 0 upvotes on the issue and could not be reproduced by one of the developers

BloodyIron commented 1 year ago

Well I have no idea what more I can do on my end, as I do believe I've exhausted all visible troubleshooting and feedback steps that one would take.

A fresh OS install is pretty absolute.

BloodyIron commented 1 year ago

I'm still having this issue by the way. I'm now on a fresh install of Ubuntu 23.04, with GNOME 44 (fresh as of a few months ago, like complete blank slate install). The behaviour is still the same.

Element version: 1.11.39 Olm version: 3.2.14

I don't know if it's somehow magically relevant, but my system is running 3x monitors, L and R are 1920x1080 and Center is 2560x1440.

Also, this same issue happens on my SO's computer, I believe they're running either Ubuntu 20.04 or 22.04 (I forget this moment) and their setup is 2x monitors each 1920x1080. And they are also on the stock included GNOME for their install.

So the evidence I have in-hand seems to reliably show this isn't tied to a specific computer or specific install of Ubuntu.

BloodyIron commented 1 year ago

Another confirmation on another brand new install of Ubuntu 22.04. Just installed Element Desktop on it and the startup behaviour (after a fresh login) is happening on this system too. Whereby Element starts in the systray (due to --hidden launch flag) and I use the keyboard shortcut (super + number-corresponding-to-element) to launch Element. Again, it launches a second running instance instead of restoring/unhiding the already-running instance.

For me, this is easily reproducible. And this system has only one monitor attached.

Element version: 1.11.39 Olm version: 3.2.14

BloodyIron commented 1 year ago

On this new system I just mentioned, I executed the same tests via CLI to get output.

After a fresh login, Element is already in the systray ala --hidden. I go to my CLI and run element-desktop, and this is the start of the output:

/home/REDACTED/.config/Element exists: yes
/home/REDACTED/.config/Riot exists: no
Starting auto update with base URL: https://packages.element.io/desktop/update/
Auto update not supported on this platform
Fetching translation json for locale: en_EN
Changing application language to en
Fetching translation json for locale: en
Resetting the UI components after locale change

But if I fully close all Element Desktop instances running. Then re-open Element Desktop, and send it to the systray (x in top right). I then open a CLI and run element-desktop while the other instance is in systray (but did not start with login process), I get this output:

/home/REDACTED/.config/Element exists: yes
/home/REDACTED/.config/Riot exists: no
Other instance detected: exiting

And then it correctly, immediately, quits the second instance of Element Desktop.

This whole issue seems to rely on how Element Desktop detects another instance of itself, and that method somehow not working when Ubuntu/Gnome auto-starts it after login.

This issue is so consistent now, I really do think this warrants a milestone or some sort of triage, etc. Can we please get someone to add this to some sort of queue or equivalent? 🤔

t3chguy commented 1 year ago

This whole issue seems to rely on how Element Desktop detects another instance of itself, and that method somehow not working when Ubuntu/Gnome auto-starts it after login.

https://www.electronjs.org/docs/latest/api/app#apprequestsingleinstancelockadditionaldata

BloodyIron commented 1 year ago

So what's to be done then?

t3chguy commented 1 year ago

@BloodyIron as someone who can reproduce it I suggest opening an issue with Electron upstream.

BloodyIron commented 1 year ago

I don't develop with Electron though, I realistically cannot represent what in the code is actually causing the problem. Is this the response for every up-stream bug that is identified? It seems reasonable to me the Matrix devs are the ones to engage up-stream devs (Electron or otherwise) on bugs of such nature. I mean, you were able to identify that the likely cause is in Electron itself, not me. I'm game for helping test stuff, but beyond that I really don't see myself an appropriate candidate.

t3chguy commented 1 year ago

@BloodyIron and I can't reproduce your issue so cannot field the questions they'd have without being a messenger and there aren't enough hours in the day for me to be an intermediary in reporting OS/platform-specific bugs for people.

BloodyIron commented 1 year ago

@t3chguy what can you tell me about the steps you've taken to try to reproduce my results? Maybe I can follow your steps and we can build on that.

For example, in the 3x different computers the behaviour has been observed on the OS is installed bare metal, not in a VM. I'm not sure if you're trying in a VM (or if that even changes anything).

I certainly do recognise and appreciate that time is a finite resource, and I'm not trying to get blood from a stone here. However I really do not believe I am an appropriate candidate for engaging upstream devs as I have nowhere near the same exposure to the Element code as I do believe you have (and yeah that is an assumption indeed).

So maybe we can compare notes further and build on that or something. :) I do appreciate your time (and the time of all those involved in Element/Matrix stuff), and I really hope we can get this figured out, even if it takes more time.

t3chguy commented 1 year ago

@BloodyIron I used a VM under UTM on my Macbook M1, using https://mac.getutm.app/gallery/ubuntu-20-04 - installed Element Desktop (not nightly) and enabled start at boot in Element's settings. Restarted, waited for it to launch, clicked icon to bring it up from the background (could see it alive and well in the tray) - only ended up with 1 tray icon.

QEDeD commented 1 year ago

I seem to have run into the same scenario of Element actually running, but that not being detected if I try to start it via CLI:

➜  ~ element-desktop --verbose
/home/$user/.config/Element exists: yes
/home/$user/.config/Riot exists: no
Starting auto update with base URL: https://packages.element.io/desktop/update/
Auto update not supported on this platform
Fetching translation json for locale: en_EN
Changing application language to en-us,en,en,en
Fetching translation json for locale: en-us
Fetching translation json for locale: en
Fetching translation json for locale: en
Fetching translation json for locale: en
Resetting the UI components after locale change
Resetting the UI components after locale change
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[60859:0908/191458.982725:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times!
[60859:0908/191458.994656:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 2 times!
Changing application language to en-us,en,en,en
Fetching translation json for locale: en-us
Fetching translation json for locale: en
Fetching translation json for locale: en
Fetching translation json for locale: en
Resetting the UI components after locale change
[60815:0908/191500.043575:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191501.050254:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191502.324588:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191503.331290:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60859:0908/191503.366601:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 3 times!
[60815:0908/191504.343828:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191505.350775:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191513.803604:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191514.811300:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191515.827334:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191516.834053:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191517.841106:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191518.848409:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191519.855505:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191520.862676:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191521.869991:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191522.876871:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191523.884285:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191524.891070:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191525.898147:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191526.904960:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191527.916695:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191528.924641:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191530.180620:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191531.188377:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191532.197643:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[60815:0908/191533.205643:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/$user/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
kortschak commented 6 months ago

I have just experienced this. It appears to be due to leveldb corruption. I restored a copy of ~/.config/Riot (yes, my install that old, though using Element) from last week and the issue is resolved.

BloodyIron commented 6 months ago

I have just experienced this. It appears to be due to leveldb corruption. I restored a copy of ~/.config/Riot (yes, my install that old, though using Element) from last week and the issue is resolved.

And for those of us who don't have such old copies/backups? Surely we can actually find a solution. This STILL is happening for me.

kortschak commented 6 months ago

Sorry, this wasn't to suggest the problem is solved, but that it is due to file corruption, and where.

BloodyIron commented 6 months ago

But it is not due to corruption, because it happens on fresh installs that don't have such data at all. You may have found an example solution in one specific scenario, but it is not the scenario this whole thing is about..

BloodyIron commented 5 months ago

I am still having this problem EVERY SINGLE TIME I REBOOT ON EVERY LINUX COMPUTER I USE ELEMENT DESKTOP ON. (which is multiple)

BloodyIron commented 2 months ago

This is no longer just a boot problem, this has actually become a problem at any time. I'll have Element already running and minimised to my system tray (again Ubuntu Linux) and I click on Element on my app-bar, expecting it to open the already-running instance. Instead it starts an additional instance of Element almost every time.

Element version: 1.11.71 Crypto version: Rust SDK 0.7.1 (80a151e), Vodozemac 0.6.0

This issue has not improved in over 2 years now. When will this be taken seriously? This is very easy to reproduce and it happens on every computer in my household.

BloodyIron commented 2 months ago

@t3chguy can we please get this revisited?

t3chguy commented 2 months ago

@BloodyIron that isn't under my control. I suggest you find other people who can reproduce and get some upvotes.