Konsole is causing a loop to constantly read from /etc/passwd every second.. even while idle by pulling information from /proc/{pid}/stat etc.. Is there no better way of doing this? Reproducible: Always Steps to Reproduce: 1. strace -p {konsole} 2. inotifywait /etc/passwd -mrq 3. Actual Results: Constant reading of /etc/passwd every second because of constant /proc access even while idle. Expected Results: I'm sure it's reading from a cached passwd file but I don't think there should be any activity while idle or while nothing is running in Konsole window.
yep
Confirmed in Konsole Version 2.12.3.
I'm running konsole5 15.12.3 and the behavior persists. Is there anything we can do to track this down? Some time ago there was a big push to minimize the number of wakeups programs were doing in order to extend battery life. Is there still any focus on that kind of thing, or still anyone keeping track of places which need optimization of wakeups?
I'm looking at this - it is the readUserName() which is causing this.
Git commit 0edded4975b6c687d6c8b671b13dadf498e76b7f by Kurt Hindenburg. Committed on 30/05/2016 at 23:58. Pushed by hindenburg into branch 'master'. Only readUserName if tab title format has %u readUserName() reads /etc/passwd every few seconds. Change it to only do this if we need to replace %u with the user name in the tab title. A temporary helper as this doesn't really fix the underlining issue. ProcessInfo really needs re-worked. M +37 -21 src/ProcessInfo.cpp M +8 -3 src/ProcessInfo.h M +4 -2 src/Session.cpp http://commits.kde.org/konsole/0edded4975b6c687d6c8b671b13dadf498e76b7f
This needs to be fixed as it also has an impact on battery life. Note the bad behavior is multiplied by the number of applications using konsole part. Right now I see tons of open/close events from yakuake/dolphin/kate/kdevelop on /etc/passwd. With 2x kdevelop, 1x kate, 1x yakuake with 10x konsole windows I get around 35 OPENs on /etc/passwd per second. Easy to test: sudo fatrace -f O -s 10 | grep /etc/passwd | wc -l
Yes, it causes about 130 events per second for me, constantly. Most of that comes from a kate window (I have some files opened) and yakuake (I have several tabs opened, but not too many, around 10).
The reading of /etc/passwd is just the most visible symptom, it can be fixed with KDirWatch. Ideally there'd be ways to blocking-wait for changes in all (or as many as possible) of the process / tab title information.
with https://quickgit.kde.org/?p=konsole.git&a=commit&h=bb6abc0bc8a23f46752f7341d43e4275e9085fa9 one possible solution is to not call updateWorkingDirectory() in getDynamicTitle() if _reportedWorkingUrl is valid.
Git commit e07a62ede32467089c1e4c57f7fed141ea009c49 by Martin T. H. Sandsmark. Committed on 27/08/2016 at 11:26. Pushed by sandsmark into branch 'master'. Remove unused environment reading code REVIEW: 128674 M +26 -150 src/ProcessInfo.cpp M +11 -48 src/ProcessInfo.h http://commits.kde.org/konsole/e07a62ede32467089c1e4c57f7fed141ea009c49
Git commit 392ee33cf8ffec54d41d342d7cba8fe82a13adc0 by Martin T. H. Sandsmark. Committed on 27/08/2016 at 20:41. Pushed by sandsmark into branch 'master'. Don't re-read process information that should be static This changes the process info code to only update the information that can change about a process when updating information about a process. REVIEW: 128777 M +125 -110 src/ProcessInfo.cpp M +8 -7 src/ProcessInfo.h http://commits.kde.org/konsole/392ee33cf8ffec54d41d342d7cba8fe82a13adc0
Git commit e7770aba9f6af26cba3dbecc1ac085acb214c6cc by Martin T. H. Sandsmark. Committed on 28/08/2016 at 15:04. Pushed by sandsmark into branch 'master'. Avoid polling processes if they report what we need with OCS7 This is apparently what the OCS7 stuff is supposed to solve, so let's use it if we can. REVIEW: 128784 M +0 -27 src/ProcessInfo.cpp M +5 -24 src/ProcessInfo.h M +44 -6 src/Session.cpp http://commits.kde.org/konsole/e7770aba9f6af26cba3dbecc1ac085acb214c6cc