Element desktop starts new instance instead of opening old instance
Steps to reproduce
- Launch Element desktop
- Close the App (make sure it’s running in the background)
- Launch Element again
Outcome
What did you expect?
The old Element desktop instance reopens.
What happened instead?
A new Element instance opens and prompts to log in. This seems like it could corrupt state.
Operating system
NixOS 22.05.20220511.41ff747 (Quokka)
Application version
Element version: 1.10.11, Olm version: 3.2.8
How did you install the app?
using home-manager, from nixpkgs
Homeserver
matrix.org
Will you send logs?
Yes
This sounds like a packaging issue with the community-maintained nixpkg, I suggest contacting the maintainer. Flatpak had a similar issue due to sandboxing.
It doesn’t happen immediately after startup, as I’ve found out now. It sometimes happens a while later. Maybe it happens on suspend? I feel like this isn’t a packaging issue, as console element-desktop invocations detect the instance normally but also don’t for me sometimes.
Well its either a packaging issue or an electron one as this is a built-in feature of electron, https://www.electronjs.org/docs/latest/api/app#apprequestsingleinstancelockadditionaldata
I will test if this is triggered by suspend. Thank you for the information!
I am now somewhat sure this is caused by suspend.
The second instance is being detected by any third instance.

Closing the first instance and re-launching via CLI launches a second instance.

I have the same Problem with the standard repo https://packages.element.io/debian/ When the instance is already running, it tries to start a new one. When you open element out of a matrix.to link it tries to open a new one.
It seems to have to do with the autostart. When you close the autostarted element and start it normal the problem vanished. Then you get this in a terminal: /opt/Element/element-desktop %U
/home/jokergermany/.config/Element exists: yes
/home/jokergermany/.config/Riot exists: no
Other instance detected: exiting
Will post tomorrow the terminal output when the bug appers.
/opt/Element/element-desktop --hidden
/home/jokergermany/.config/Element exists: yes
/home/jokergermany/.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 de
Fetching translation json for locale: de
Resetting the UI components after locale change
Resetting the UI components after locale change
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
[324551:0807/192947.281627:ERROR:browser_main_loop.cc(271)] Gdk: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
Changing application language to de
Fetching translation json for locale: de
Resetting the UI components after locale change
[324551:0807/192952.408606:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/jokergermany/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/jokergermany/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[324551:0807/192953.418660:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/jokergermany/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/jokergermany/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[324551:0807/192953.748112:ERROR:nss_util.cc(335)] After loading Root Certs, loaded==false: NSS error code: -8018
[324551:0807/192954.885684:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/jokergermany/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/jokergermany/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
[324551:0807/192955.895411:ERROR:leveldb_factory.cc(88)] Failed to open LevelDB database from /home/jokergermany/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb,IO error: /home/jokergermany/.config/Element/IndexedDB/vector_vector_0.indexeddb.leveldb/LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)
The last line repeats over and over again
@t3chguy Pls remove the X-Community-Supported-Platform
This is the same issue I've been seeing for over a year now in vector-im/element-desktop#679
Can we get some eyes on this already??? :/
Duplicate of vector-im/element-desktop#679