Slow launch of Electron apps - long wait4 in strace

Hello everybody,
I’m new to NixOS (this is my 3rd day) so apologies in advance in case I missed something “obvious” or am not following best forum practices.

Some of my electron apps are starting very slowly on every launch. Using them is fast as expected. Signal Desktop and Bitwarden are the culprits, while Spotify, Discord and VSCode (FHS) behave as expected.

My system:

  • CPU: AMD Ryzen 7 2700
  • GPU: AMD Vega 56
  • RAM: 32GB DDR4
  • Drive: Kingston M.2 Pcie
  • DE: Plasma 6 Wayland
  • Managed with flakes

What I checked:
I made sure AMD drivers are installed. I load amdgpu early with boot.initrd.kernelModules = [ "amdgpu" ];, installed amdvlk: hardware.graphics.extraPackages = [pkgs.amdvlk]; and chose amdgpu as default driver services.xserver.videoDrivers = [ "amdgpu" ];

Troubleshooting
Since previous steps didn’t help, I took a look at the syscalls with strace -tt -o <output.txt> <app> and discovered that signal and bitwarden sometimes wait ages for a child process, e.g.

08:32:43.730201 close(59) = 0
08:32:43.730397 wait4(24967, [{WIFEXITED(s) && WEXITSTATUS(s) == 4}], 0, NULL) = 24967
08:32:51.242311 — SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=24967, si_uid=1000, si_status=4, si_utime=1 /* 0.01 s /, si_stime=1 / 0.01 s */} —

in case of signal or

08:36:58.659444 mprotect(0x12bc024d0000, 16384, PROT_READ|PROT_WRITE) = 0
08:36:58.659663 wait4(41986, [{WIFEXITED(s) && WEXITSTATUS(s) == 4}], 0, NULL) = 41986
08:37:05.855748 — SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=41986, si_uid=1000, si_status=4, si_utime=0, si_stime=0} —
08:37:05.855881 rt_sigreturn({mask=}) = 41986
08:37:05.856221 futex(0x12bc0004476c, FUTEX_WAKE_PRIVATE, 1) = 1

in case of bitwarden.

I dug deeper into Signal using strace -tt -f -o ... and found failed read attempts to the nixstore around the unusual waits, like here:

46439 09:00:22.146431 readlink(“/etc/profiles/per-user”, <unfinished …>
46439 09:00:25.464310 statx(AT_FDCWD, “/nix/store/vmj55f4sc24mhzag9dxq40dkxaq1v83y-pipewire-1.2.7/share/mime/application/x-nautilus-link.xml”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, 0x7ffe1705f340) = -1 ENOENT (No such file or directory)
46439 09:00:26.464317 statx(AT_FDCWD, “/run/current-system/sw/share/mime/image/x-jp2-codestream.xml”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=2411, …}) = 0
46439 09:00:33.246431 statx(AT_FDCWD, “/nix/store/a00mkfifxn8jljlr005yir9gfqdg052d-kdesu-6.8.0/share/mime/application/x-kontour.xml”, AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_ALL, 0x7ffe1705f340) = -1 ENOENT (No such file or directory)
46431 09:00:35.494633 <… wait4 resumed>[{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 46439

In general, I noticed many ENOENTs trying to read from the nix store, they all looked like attempts to read dynamic libraries for linking. Not all of them are accompanied by long wait times and they sometimes happen with the fast starting electron apps, too.

I also noticed that all electron apps that launch fast (Discord, Spotify, VsCode FHS) are closed source and all apps that launch slowly are open source (Signal, Bitwarden).

Conclusion
The above makes me think that there might be an issue with the nix store and the availability of libraries. I installed nix-ld, but sadly it didn’t help. At this point I reached the end of my rather limited NixOS knowledge and require support.

  1. Do you agree that this is a library issue or do you think otherwise?
  2. If you agree, how can I fix this?

I like the idea of NixOS and am not afraid to tinker, so I would really like to get it working smoothly. If you know a pastebin that allows pastes with a size of a few MBs I’d be happy to share my straces too. Thanks for your help in advance!

Kind regards,
Chris