keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
21.27k stars 1.47k forks source link

100% cpu usage when locking sway with open database from gvfs directory #6693

Closed abraxxa closed 3 years ago

abraxxa commented 3 years ago

Overview

KeepassXC uses 100% cpu on one core after locking my Ubuntu 21.04 with sway (wayland) when I have a database open from a gvfs mounted directory (/run/user/1000/gvfs/$sharename).

Steps to Reproduce

  1. Mount a smb share using Gnome Files
  2. Open a database from the /run/user/$uid/gvfs/$sharename directory
  3. lock sway using a keyboard combination which starts swaylock

Expected Behavior

CPU usage stays the same

Actual Behavior

CPU goes to 100% on one core after some time After unlocking Sway KeepassXC doesn't react any more to user input and needs to be killed with a SIGKILL.

Context

sudo strace -p $pid_of_keepassxc showed that it tries to open truetype fonts all the time:

openat(AT_FDCWD, "/usr/share/fonts/truetype/lohit-kannada/Lohit-Kannada.ttf", O_RDONLY) = 26
fcntl(26, F_SETFD, FD_CLOEXEC)          = 0
newfstatat(26, "", {st_mode=S_IFREG|0644, st_size=197796, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 197796, PROT_READ, MAP_PRIVATE, 26, 0) = 0x7f03049a3000
close(26)                               = 0
munmap(0x7f03049a3000, 197796)          = 0
openat(AT_FDCWD, "/usr/share/fonts/truetype/lohit-telugu/Lohit-Telugu.ttf", O_RDONLY) = 26
fcntl(26, F_SETFD, FD_CLOEXEC)          = 0
newfstatat(26, "", {st_mode=S_IFREG|0644, st_size=341752, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 341752, PROT_READ, MAP_PRIVATE, 26, 0) = 0x7f0304980000
close(26)                               = 0
munmap(0x7f0304980000, 341752)          = 0
openat(AT_FDCWD, "/usr/share/fonts/truetype/sinhala/lklug.ttf", O_RDONLY) = 26
fcntl(26, F_SETFD, FD_CLOEXEC)          = 0
newfstatat(26, "", {st_mode=S_IFREG|0644, st_size=306452, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 306452, PROT_READ, MAP_PRIVATE, 26, 0) = 0x7f0304989000
close(26)                               = 0
munmap(0x7f0304989000, 306452)          = 0
openat(AT_FDCWD, "/usr/share/fonts/truetype/freefont/FreeMono.ttf", O_RDONLY) = 26
fcntl(26, F_SETFD, FD_CLOEXEC)          = 0
newfstatat(26, "", {st_mode=S_IFREG|0644, st_size=359312, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 359312, PROT_READ, MAP_PRIVATE, 26, 0) = 0x7f030497c000
close(26)                               = 0
munmap(0x7f030497c000, 359312)          = 0
openat(AT_FDCWD, "/usr/share/fonts/truetype/freefont/FreeSans.ttf", O_RDONLY) = 26
fcntl(26, F_SETFD, FD_CLOEXEC)          = 0
newfstatat(26, "", {st_mode=S_IFREG|0644, st_size=837952, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 837952, PROT_READ, MAP_PRIVATE, 26, 0) = 0x7f0304907000
close(26)                               = 0
munmap(0x7f0304907000, 837952)          = 0
openat(AT_FDCWD, "/usr/share/fonts/truetype/freefont/FreeSerif.ttf", O_RDONLY) = 26
fcntl(26, F_SETFD, FD_CLOEXEC)          = 0
newfstatat(26, "", {st_mode=S_IFREG|0644, st_size=2006044, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 2006044, PROT_READ, MAP_PRIVATE, 26, 0) = 0x7f03047ea000
close(26)

KeePassXC - Version 2.6.6 Revision: 9c108b9

Qt 5.15.2 Debugging mode is disabled.

Operating system: Ubuntu 21.04 CPU architecture: x86_64 Kernel: linux 5.11.0-22-generic

Enabled extensions:

Cryptographic libraries:

Operating System: Linux Desktop Env: Sway Windowing System: Wayland

droidmonkey commented 3 years ago

Looks like a Qt bug

abraxxa commented 3 years ago

Also happens when I only have a local Keepass database open. Can you please link the Qt bug you're referring to?

droidmonkey commented 3 years ago

See #6588

abraxxa commented 3 years ago

And this is it? It's a bug from the framework you use and you don't care? What's required to fix my issue? A newer Qt shipped by Ubuntu which you build against and which you can't influence or is keepassxc compiled against whatever version you want and bundled?

droidmonkey commented 3 years ago

You want us to fix another vendor's software?

You have several options that might work:

abraxxa commented 3 years ago

This wasn't clear from your answer so I asked. I'll try the appimage tomorrow and report back if the issue is gone.

abraxxa commented 3 years ago

I've tested the AppImage now but it's compiled without wayland support:

$ ./KeePassXC-2.6.6-x86_64.AppImage 
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)