Skip to content

[Bug]: Second launch attempt (while already running) fully boots Chromium/Electron before checking single-instance lock, causing a noticeable delay #2258

Description

@KBeiller

I have already checked through the existing (both open AND closed) bug reports and found no duplicates

  • Yes

App Version

1.13.0-2

Music Server and Version

Navidrome v0.61.2

What local environments are you seeing the problem on?

Desktop Linux

What happened?

Expected Behavior

When Feishin is already running and a new launch is attempted, the new process should detect the existing instance almost instantly and just focus/restore the existing window — similar to how the tray's "Show Window" action is instant.

Current Behavior

Launching Feishin again while an instance is already running takes a noticeable, consistent delay (~0.5s) before the existing window gets focus. This doesn't happen when using "Show Window" from the tray icon, which is instant.

strace -f -tt on the second launch shows a full Electron/Chromium process tree spawning (GPU process, network service, audio service, utility processes) and then exiting, all within about a second:

40870 14:46:14.160838 execve("/usr/bin/feishin", ["feishin"], ...) = 0
...
40905 14:46:15.192085 +++ exited with 0 +++
...
40870 14:46:15.200098 +++ exited with 0 +++

ps -eo pid,ppid,etimes,cmd captured mid-launch shows a brand new top-level Electron process (ppid=1, etimes=0) briefly coexisting with the original instance before disappearing:

39219   1   736   /usr/lib/electron41/electron --enable-gpu-rasterization ... (original instance)
42574   1     0   /usr/lib/electron41/electron --enable-gpu-rasterization ... (new, short-lived instance)

time feishin while an instance is already running (ran twice for consistency):

feishin  0.50s user 0.10s system 114% cpu 0.522 total
feishin  0.50s user 0.10s system 114% cpu 0.524 total

Analysis
This suggests the new process fully initializes Electron/Chromium (GPU, network, audio subsystems) before checking app.requestSingleInstanceLock() and handing off to the existing instance via the second-instance event, rather than checking the lock and quitting first thing in the main process.

AI WAS USED IN THIS ISSUE
I used AI to diagnose and try to get a simple explanation for this issue as I am not yet a linux savy. I reviewed everything and considered this would be helpful. Please provide feedback on the way this issue was opened so I can improve and build better issues for both you and other devs. Thanks.

Steps to reproduce

  1. Launch Feishin, let it fully start.
  2. Minimize it.
  3. Launch Feishin again from a launcher app or through a terminal.
  4. Notice the delay before the window comes to focus, compared to using "Show Window" from the tray.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions