Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High idle CPU usage #2652

Closed
grigorig opened this issue Jan 26, 2019 · 22 comments
Closed

High idle CPU usage #2652

grigorig opened this issue Jan 26, 2019 · 22 comments

Comments

@grigorig
Copy link

Expected Behavior

KeePassXC idles at approximately 0% CPU usage.

Current Behavior

High idle CPU usage of around 2% on Linux/X11 (on an Intel i5-6200U CPU). The KeePassXC process seems to wake up around 60 times per second (according to powertop) even when there is no database open and/or the window is minimzed. This negatively affects battery life.

Debug Info

KeePassXC - Version 2.3.4
Revision: 6fe821c

Libraries:

  • Qt 5.11.3
  • libgcrypt 1.8.4

Operating system: Fedora 29 (Workstation Edition)
CPU architecture: x86_64
Kernel: linux 4.20.3-200.fc29.x86_64

Enabled extensions:

  • Auto-Type
  • Browser Integration
  • Legacy Browser Integration (KeePassHTTP)
  • SSH Agent
  • YubiKey
@grigorig grigorig added the bug label Jan 26, 2019
@droidmonkey
Copy link
Member

I've noticed very high CPU usage on Windows 10 under the new 2.4.0 version on several occasions. Although it goes away after I lock and reopen the database.

@mreppen
Copy link

mreppen commented May 14, 2019

FWIW, I have the same problem on two computers with KeepassXC 2.4.1.

Anything I can do to troubleshoot?

Lock/reopen does not change anything.

@droidmonkey
Copy link
Member

Oh this issue referenced here was corrected. High cpu has been reported on macOS, but I strongly believe that it's a qt bug.

@tmst
Copy link

tmst commented May 16, 2019

This is still annoying me on x86/linux.
Linux linux-weh4.suse 4.4.176-96-default #1 SMP

$> keepassxc --version
qt5ct: using qt5ct plugin
keepassxc 2.2.4

@droidmonkey
Copy link
Member

You are on an EXTREMELY outdated version of KeePassXC

@grigorig
Copy link
Author

Well, it's definitely not fixed. Can you point me to the commit(s) that supposedly fix this issue?
I still see at least 1.3% constant CPU usage with 20-60 wakeupsof the keepassxc process per second (according to powertop).

Here's my version info:

KeePassXC - Version 2.4.1
Revision: 7bafe65

Qt 5.11.3
Debugging mode is disabled.

Operating system: Fedora 29 (Workstation Edition)
CPU architecture: x86_64
Kernel: linux 5.0.9-200.fc29.x86_64

@droidmonkey droidmonkey reopened this May 16, 2019
@grigorig
Copy link
Author

grigorig commented May 17, 2019

KeePassXC seems to do a lot of stuff with file descriptors used for event handling or something. I recorded this with strace:

04:37:44.521516 write(6<anon_inode:[eventfd]>, "\1\0\0\0\0\0\0\0", 8) = 8
04:37:44.521928 recvmsg(9<UNIX:[12373511->12374559]>, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
04:37:44.522462 recvmsg(9<UNIX:[12373511->12374559]>, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
04:37:44.522945 poll([{fd=6<anon_inode:[eventfd]>, events=POLLIN}, {fd=9<UNIX:[12373511->12374559]>, events=POLLIN}, {fd=12<UNIX:[12374561->12375074]>, events=POLLIN}, {fd=14<anon_inode:inotify>, events=POLLIN}, {fd=17<UNIX:[12373513->12372980]>, events=POLLIN}, {fd=19<UNIX:[12373515->12373514]>, events=POLLIN}, {fd=21<UNIX:[12373518,"/tmp/.doIUGW/s"]>, events=POLLIN}, {fd=34<anon_inode:inotify>, events=POLLIN}, {fd=35<anon_inode:inotify>, events=POLLIN}], 9, 0) = 1 ([{fd=6, revents=POLLIN}])
04:37:44.523540 read(6<anon_inode:[eventfd]>, "\1\0\0\0\0\0\0\0", 16) = 8
04:37:44.523784 recvmsg(9<UNIX:[12373511->12374559]>, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
04:37:44.524112 recvmsg(9<UNIX:[12373511->12374559]>, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
04:37:44.524295 poll([{fd=6<anon_inode:[eventfd]>, events=POLLIN}, {fd=9<UNIX:[12373511->12374559]>, events=POLLIN}, {fd=12<UNIX:[12374561->12375074]>, events=POLLIN}, {fd=14<anon_inode:inotify>, events=POLLIN}, {fd=17<UNIX:[12373513->12372980]>, events=POLLIN}, {fd=19<UNIX:[12373515->12373514]>, events=POLLIN}, {fd=21<UNIX:[12373518,"/tmp/.doIUGW/s"]>, events=POLLIN}, {fd=34<anon_inode:inotify>, events=POLLIN}, {fd=35<anon_inode:inotify>, events=POLLIN}], 9, 13) = 0 (Timeout)
04:37:44.538090 write(6<anon_inode:[eventfd]>, "\1\0\0\0\0\0\0\0", 8) = 8
04:37:44.538426 recvmsg(9<UNIX:[12373511->12374559]>, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
04:37:44.538634 recvmsg(9<UNIX:[12373511->12374559]>, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
04:37:44.538821 poll([{fd=6<anon_inode:[eventfd]>, events=POLLIN}, {fd=9<UNIX:[12373511->12374559]>, events=POLLIN}, {fd=12<UNIX:[12374561->12375074]>, events=POLLIN}, {fd=14<anon_inode:inotify>, events=POLLIN}, {fd=17<UNIX:[12373513->12372980]>, events=POLLIN}, {fd=19<UNIX:[12373515->12373514]>, events=POLLIN}, {fd=21<UNIX:[12373518,"/tmp/.doIUGW/s"]>, events=POLLIN}, {fd=34<anon_inode:inotify>, events=POLLIN}, {fd=35<anon_inode:inotify>, events=POLLIN}], 9, 0) = 1 ([{fd=6, revents=POLLIN}])
04:37:44.539284 read(6<anon_inode:[eventfd]>, "\1\0\0\0\0\0\0\0", 16) = 8
04:37:44.539458 recvmsg(9<UNIX:[12373511->12374559]>, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
04:37:44.539595 recvmsg(9<UNIX:[12373511->12374559]>, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)

It repeats like that ad nauseam. As you can see, it polls a bunch of file descriptors all the time and does some reads and writes. I really wonder what these are for.

@droidmonkey
Copy link
Member

droidmonkey commented May 17, 2019

I am looking into this. This could be the browser extension reading and writing to the proxy stdin pipe. If so, there may be a very tight loop that is being triggered.

@grigorig
Copy link
Author

FWIW, I have disabled all browser integration functionality. Here's some more info. The wakeup storm starts after the first locking. So, I start up KeePassXC, and it's fine. Wakeups only happen on activity with the UI. I unlock a database, still fine. Wakeups only happen every couple of seconds. But after locking that database - 60 wakeups per second. And they continue if I unlock again.

@droidmonkey
Copy link
Member

OK that is great info, helps me narrow down the debugging.

@tmst
Copy link

tmst commented May 25, 2019

Debugging this would be a drag. It's no longer acting up on my box and now waking up maybe a few times/min regardless of whether the db is locked. The only things I can think of is that I haven't suspended since the last time I launched it, and that I've installed openvpn which had some dependencies. Maybe something related to Keepass got updated. I'm also running it under alltray, which is quiet as a mouse.

@m-khvoinitsky
Copy link

Same here. According to top, keepassxc eats about 4% — 6% CPU when does nothing.

  • Archlinux
  • Qt 5.13.0
  • KeepassXC 2.4.3
  • Wayland/Sway (but running via xcb/XWayland)
  • only Auto-Type is enabled

@e00E
Copy link

e00E commented Nov 5, 2019

I am experiencing this issue. Same setup as the poster above me, but everything up to date.

@droidmonkey
Copy link
Member

Fixed in 2.5.1

@m-khvoinitsky
Copy link

The problem still exists in 2.5.3.

@m-khvoinitsky
Copy link

m-khvoinitsky commented Feb 24, 2020

What I've found that is only happening when using Breeze theme (CPU usage is about 5%, strace is flooding with something similar to #2652 (comment), with other theme strace output is silent, CPU usage is zero). I'm using qt5ct, not sure if that matters.

UPD: not only Breeze is affected, but the behaviour is different depending on theme:
Affected themes:

  • Breeze
  • Oxygen
  • CDE (but now strace is showing constant calling to stat of /etc/localtime instead of polling some fd)
  • Motif (same as with CDE)
  • ...

Unaffected themes:

  • Windows
  • Fusion
  • ...

Other Qt application with this themes are not affected.

@droidmonkey
Copy link
Member

droidmonkey commented Feb 24, 2020

Considering a platform plugin (theme) does not impact the functions of our code base it sure seems like a Qt bug. Understand your assertion about other apps, but they may not be using the affected code in those plugins.

@coiby
Copy link

coiby commented Feb 25, 2020

What I've found that is only happening when using Breeze theme (CPU usage is about 5%, strace is flooding with something similar to #2652 (comment), with other theme strace output is silent, CPU usage is zero). I'm using qt5ct, not sure if that matters.

UPD: not only Breeze is affected, but the behaviour is different depending on theme:
Affected themes:

  • Breeze
  • Oxygen
  • CDE (but now strace is showing constant calling to stat of /etc/localtime instead of polling some fd)
  • Motif (same as with CDE)
  • ...

Unaffected themes:

  • Windows
  • Fusion
  • ...

Other Qt application with this themes are not affected.

I also used qt5ct. I can confirm the theme Windows doesn't have this issue and adwaita theme can also reproduce this issue.

@m-khvoinitsky
Copy link

Considering a platform plugin (theme) does not impact the functions of our code base it sure seems like a Qt bug. Understand your assertion about other apps, but they may not be using the affected code in those plugins.

I'm sorry for bothering you with this again but may be you can help debugging it and report the problem to the right people?

@droidmonkey
Copy link
Member

I dont have time to do that unfortunately

@ivankovnatsky
Copy link

also experienced that from time to time, as a first guess it cpu usage would go up after sleep, but the app itself becomes unresponsive, and i have to terminate it to use it.

@abraxxa
Copy link

abraxxa commented Jun 9, 2021

Same here. Seems to occur every time I lock sway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants