Summary: | KFileWidget is laggy on systems with many groups | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-kio | Reporter: | Ilya Bizyaev <bizyaev> |
Component: | Open/save dialogs | Assignee: | KIO Bugs <kio-bugs-null> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | aspotashev, fabian, kdelibs-bugs-null, meven, nate, tlangner+kde |
Priority: | NOR | Keywords: | regression |
Version First Reported In: | 6.14.0 | ||
Target Milestone: | --- | ||
Platform: | Debian testing | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Flame graph (problematic calls have a blue outline) |
Description
Ilya Bizyaev
2025-05-15 18:28:47 UTC
Created attachment 181350 [details]
Flame graph (problematic calls have a blue outline)
(In reply to Ilya Bizyaev from comment #0) > SUMMARY > When browsing directories with restricted (unreadable) subdirectories, such > as /tmp, the KDE file dialog has major UI lags if the system has many > groups. This affects file pickers in KDE and Qt apps, as well as the XDG > portal. > > This is caused by repeated calls to KUser::groups from the paint code, which > calls getgrouplist, which has to read and parse /etc/group and > /etc/group.cache over and over again. See the attached flame graph. > > $ cat /etc/group.cache | wc -l > 27634 > $ du -h /etc/group.cache > 752K /etc/group.cache > > There should be no need for this: getgrouplist's result can be cached and > reused for the duration of the dialog's execution. IMO it should just use access(R_OK) instead. Apparently this behaviour of trying to handle permission checks in KIO code was introduced by https://invent.kde.org/frameworks/kio/-/merge_requests/1221, ironically with the motivation to avoid stat() calls. $ cat /etc/group.cache | wc -l
27634
$ du -h /etc/group.cache
752K /etc/group.cache
That's proper system stress testing.
> IMO it should just use access(R_OK) instead.
That's a good idea, re implementing this logic wasn't a particular great idea.
Just for reference, this bug makes the file picker almost unusable on my system. I have a similar setup as Ilya with logs of groups on my system. Is there a chance that someone could look at this in the near future? Thanks a lot! |