Bug 348521 - Dolphin is a little bit slow to startup
Summary: Dolphin is a little bit slow to startup
Status: CONFIRMED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 15.12.0
Platform: Kubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL: http://forums.netrunner.com/showthrea...
Keywords:
: 384501 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-05-31 20:53 UTC by jeremy9856
Modified: 2021-11-18 23:13 UTC (History)
17 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Debug performance issues with strace (360.75 KB, application/zip)
2015-06-04 16:43 UTC, jeremy9856
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jeremy9856 2015-05-31 20:53:30 UTC
Hello,

I'm on Netrunner 14 and I found Dolphin a bit slow to open compared to Nautilus and others softs that opens instantly.
I have a SSD Samsung 840 and Dolphin is the only softs that is "relatively" slow to start. It has a 1s lag on openning.

I made a little video to show you the lag :

http://youtu.be/bAyPs5mxBYw

Reproducible: Always

Steps to Reproduce:
1. Open Dolphin

Actual Results:  
Slow start

Expected Results:  
Fast start
Comment 1 Frank Reininghaus 2015-06-04 13:11:08 UTC
Thanks for the bug report! It's a bit difficult to guess what causes the slow startup on your system, and if it has anything to do with Dolphin itself, or with some KDE libraries that Dolphin uses. Is Dolphin really the only application that is affected? What about other KDE applications, such as KWrite? Do you notice similar delays if you open the application or if you open the "Open File" dialog?
Comment 2 jeremy9856 2015-06-04 15:19:45 UTC
I don't think it's related to my system (i3 2100, SSD Samsung 840 250Gb, 4Gb) because I installed Netrunner (Kubuntu derivative) on some other computers and Dolphin always seems a little bit "sluggish" when you open it. I am not the only one as you can see here (http://forums.netrunner.com/showthread.php?tid=16644). I also noticed similar delays when I open the "Open File" dialog.

Of course some other application can take longer to open but it's because there are "heavy", like gimp. If I try Kate and Sublime text, they take about the same to open, 0.5s give or take.

If I compare Dolphin to others file browsers it's the slowest, it take about 1s to open. Thunar for exemple open really instantly.

1s is a short period of time but when you click on something and nothing happen for a whole second it's seems slow, especially with a SSD. Try to install Thunar to compare. It will be awesome if we can achieve this speed ;)
Comment 3 jeremy9856 2015-06-04 15:32:06 UTC
Here are some exemple of the "slow" start :

https://youtu.be/vWsJ4PQhH4s?t=3m58s
https://youtu.be/1I93Q-1SwUY?t=10s
Comment 4 Frank Reininghaus 2015-06-04 16:09:25 UTC
(In reply to jeremy9856 from comment #2)
> I also noticed
> similar delays when I open the "Open File" dialog.

In that case, the slowness is probably not caused by Dolphin itself, but by some of the libraries that Dolphin and the file dialog use.

BTW, does it start faster if you hide the "Places" panel?

> 1s is a short period of time but when you click on something and nothing
> happen for a whole second it's seems slow, especially with a SSD. Try to
> install Thunar to compare. It will be awesome if we can achieve this speed ;)

I cannot reproduce a 1 second delay here, but I agree that any improvement of the startup speed would be welcome. However, finding out what the reason for the slow startup that you and some others see might not be straightforward, and it could very well be that the reason is in the libraries that Dolphin and the file dialog use, such that nothing can be done in Dolphin itself to fix it.

Note: It has been proposed recently to make all Dolphin windows share a single process ( https://git.reviewboard.kde.org/r/123921/ ). If this is implemented, then at least opening a another Dolphin window should be much faster if one window is open already.
Comment 5 jeremy9856 2015-06-04 16:43:06 UTC
Created attachment 92998 [details]
Debug performance issues with strace

Dolphin doesn't start faster if I hide the "Places" panel.

I think that Dolphin windows share a single process is a good thing, at least for the speed when you open several windows.

i recently read this article "Debug performance issues with strace" :
https://bryanquigley.com/uncategorized/debug-performance-issues-with-strace

So I tried it with Dolphin. Does it help ?
Comment 6 jeremy9856 2015-06-05 11:04:28 UTC
An other user report the same behavior

https://forum.kde.org/viewtopic.php?f=223&t=126482
Comment 7 Frank Reininghaus 2015-06-05 15:58:43 UTC
(In reply to jeremy9856 from comment #5)
> So I tried it with Dolphin. Does it help ?

Thanks. I only had a quick look, but I could not see any single obvious issue that takes a lot of time. There are lots of accesses to various files, which together cause a rather long delay, but the vast majority of these file accesses are not done by Dolphin at all, but by various libraries. There is probably a lot of room for optimizations, but I'm afraid that little can be done inside Dolphin about this. This must be done in the libraries (and then all KDE applications will benefit).
Comment 8 jeremy9856 2015-06-05 16:59:36 UTC
Ok so what next ?
You check that with the concerned people or you want me to do some other bug report at the right place or something else ?
Comment 9 Frank Reininghaus 2015-06-09 17:34:06 UTC
(In reply to jeremy9856 from comment #8)
> Ok so what next ?
> You check that with the concerned people or you want me to do some other bug
> report at the right place or something else ?

I don't know, sorry. Figuring out what code is responsible (and thus who the concerned people are and what the right product for a report is) from the traces will take some effort and time, which I currently don't have, but maybe someone else who has an idea will read this report.
Comment 10 jeremy9856 2015-06-10 00:21:44 UTC
Ok I understand. It's not a serious problem but if it can be fixed it will be a great improvement.
Comment 11 jeremy9856 2015-06-15 00:23:45 UTC
Just a little video to show you how fast is Nautilus to start

https://www.youtube.com/watch?v=CtBjaBz1u10
Comment 12 Vitor M. Pereira 2015-06-16 11:23:15 UTC
Hi. I also started suffering from this issue following an upgrade last week to kdelibs-4.14.7-4.fc21.x86_64 (I'm running Fedora 21).

I can tell that this is not dolphin-related, but is widespread to any application that needs/uses the kde "file open" dialog facility whenever that dialog is opened (dolhpin, kate, kwrite, kile, etc, even konsole, if you invoke "save output as"). This is crippling because the bulk of my productivity applications are native kde tools and saving or opening anything stalls my system nearly every time for 30-60 seconds.

It seems to be caused by endless calls to a "fd 6", which is an existing socket. Here is a quick summary of what happens running dolphin and kwrite:

=== Dolphin ===

$ strace kwrite 2>&1 | grep -i "temporarily unavailable" > strace-dolphin.log

$ grep -c "recvmsg(6.*temporarily unav.*"  strace-dolphin.log
1063

$ ls -l /proc/21982/exe
lrwxrwxrwx. 1 vpereira 0 Jun 16 18:21 /proc/21982/exe -> /usr/bin/dolphin

$ ls -l /proc/21982/fd/6
lrwx------. 1 vpereira 64 Jun 16 18:21 /proc/21982/fd/6 -> socket:[613025]

=== kwrite ===

$ strace kwrite 2>&1 | grep -i "temporarily unavailable" > strace-kwrite.log

$ grep -c "recvmsg(6.*temporarily unav.*"  strace-kwrite.log
4064

$ pgrep kwrite
22097 kwrite

$ ls -l /proc/22097/fd/6
lrwx------. 1 vpereira users 64 Jun 16 18:29 /proc/22097/fd/6 -> socket:[615328]

$  sudo netstat -apn | grep 615328
unix  3      [ ]         STREAM     CONNECTED     615328   22097/kwrite

===

Now, if I login with (what I think is a) clean kde configuration by removing (outside of kde)
  ~/.kde 
  /tmp/kde-vpereira/ 
  /var/tmp/kdecache-vpereira/ 
  /run/user/1000/ksocket-vpereira

the problem persists! It does go away if I login as a clean new user, though (meaning an empty $HOME). 

If someone can help debug or understand this further it would be much appreciated!
Comment 13 Frank Reininghaus 2015-06-16 19:33:43 UTC
(In reply to Vitor M. Pereira from comment #12)
> This is crippling because the bulk of my
> productivity applications are native kde tools and saving or opening
> anything stalls my system nearly every time for 30-60 seconds.

If the freeze takes that long, then something is seriously wrong, and getting a backtrace is the best way to find out what it is. Please see https://community.kde.org/Dolphin/FAQ/Freeze for details and file a new bug report, because this issue is different from the one that has been reported here. Thanks for your help!

(In reply to jeremy9856 from comment #11)
> Just a little video to show you how fast is Nautilus to start
> 
> https://www.youtube.com/watch?v=CtBjaBz1u10

I'm afraid that videos are not very useful for debugging performance issues. I have no idea how Nautilus' internals work - maybe new windows share a process with existing windows (as I said, this has been proposed for future Dolphin versions), maybe they even preload a Nautilus process to make startup faster or maybe it is something else altogether. Apart from that, I agree that getting rid of some of the expensive things that apparently happen when starting Dolphin (and probably other KDE apps that deal with files) would be extremely desirable, but as I said, this can only be done by analyzing carefully not only the strace logs, but especially which libraries are responsible for these expensive system calls and what exactly happens inside these libraries that Dolphin uses. Someone who has the necessary time, motivation and skills must sit down and do it. New videos do not help - sorry about that.
Comment 14 jeremy9856 2015-06-17 09:23:45 UTC
I know the videos doesn't help but it's just to show the difference in startup speed.
Maybe it can motivate someone who has the necessary time, motivation and skills ;)
Comment 15 Vitor M. Pereira 2015-06-17 14:48:43 UTC
(In reply to Frank Reininghaus from comment #13)

Thank you, Frank, for the quick reaction and your suggestion. Following it, it seems clear now that this is related to KFilePlaces somehow. I opened bug 349290 and posted a few backtraces there. 

If there is something else that I can contribute to help diagnose this, kindly let me know.
Comment 16 Vitor M. Pereira 2015-06-17 16:36:43 UTC
(In reply to Frank Reininghaus from comment #13)

A quick follow-up to mention that I can now reproducibly trace my problem down to dolphin generating a corrupted 

  ~/.kde/share/apps/kfileplaces/bookmarks.xml

when a change is made to the contents or ordering of folders in the "Places" panel. Please refer to my comments in bug 349290.
Comment 17 jeremy9856 2015-06-22 13:01:40 UTC
I checked the delay when I open the "Open File" dialog and it is at least 2 times lower than I open Dolphin. About 0.4s vs Dolphin 1s.

I don't know but maybe that mean that is something that can be improved in Dolphin ?
Comment 18 jeremy9856 2015-06-22 13:02:47 UTC
Do you think the switch to KF5 will improve the load time ?
Comment 19 Frank Reininghaus 2015-06-26 15:33:48 UTC
(In reply to jeremy9856 from comment #17)
> I checked the delay when I open the "Open File" dialog and it is at least 2
> times lower than I open Dolphin. About 0.4s vs Dolphin 1s.

Considering that the application that you use the "File" dialog with has already loaded some kdelibs or KF5 libraries that are used by the file dialog, and Dolphin has to load everything at startup, this is probably the expected behavior.
Comment 20 JohnF 2015-08-07 02:29:53 UTC
I have the same problem with startup now hitting 1minute.  This also applies to qt file-dialogs .

This is making my machine unworkable.  I am running Fedora 21 for quite some time but this only seems to have started in the last week.

I have cleared all config for dolphin with no change.

I have logged an strace.  It appears to be caught in a sequence trying to get information about a particular logical volume.  The trace is full of 'device is temporarily 

This repeats in the strace file 42000 times while dolphin is 'hung'. 
dm-4 is a mounted lv.  I have run a force fsck on it with no problems.  It is only 77% used.  Not used for any general usage.

I can attach the full strace if needed, at 108Mb.  

---strace cut---  Not sure if this is the exact loop start and finish of the loop ...


open("/etc/udev/udev.conf", O_RDONLY|O_CLOEXEC) = 18
fstat(18, {st_mode=S_IFREG|0644, st_size=49, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff94e619000
read(18, "# see udev.conf(5) for details\n\n"..., 4096) = 49
read(18, "", 4096)                      = 0
close(18)                               = 0
munmap(0x7ff94e619000, 4096)            = 0
stat("/dev/dm-4", {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 4), ...}) = 0
readlink("/sys/dev/block/253:4", "../../devices/virtual/block/dm-4", 1024) = 32
stat("/sys/devices/virtual/block/dm-4/uevent", {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
open("/sys/devices/virtual/block/dm-4/uevent", O_RDONLY|O_CLOEXEC) = 18
fstat(18, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff94e619000
read(18, "MAJOR=253\nMINOR=4\nDEVNAME=dm-4\nD"..., 4096) = 44
read(18, "", 4096)                      = 0
close(18)                               = 0
munmap(0x7ff94e619000, 4096)            = 0
readlink("/sys/devices/virtual/block/dm-4/subsystem", "../../../../class/block", 1024) = 23
open("/run/udev/data/b253:4", O_RDONLY|O_CLOEXEC) = 18
fstat(18, {st_mode=S_IFREG|0644, st_size=738, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff94e619000
read(18, "S:disk/by-id/dm-name-vg_hpmodell"..., 4096) = 738
read(18, "", 4096)                      = 0
close(18)                               = 0
munmap(0x7ff94e619000, 4096)            = 0
sendmsg(15, {msg_name(0)=NULL, msg_iov(2)=[{"l\1\0\1\0\0\0\0\234\310\0\0\223\0\0\0\1\1o\0&\0\0\0/org/fre"..., 168}, {"", 0}], msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 168
poll([{fd=15, events=POLLIN}], 1, 25000) = 1 ([{fd=15, revents=POLLIN}])
recvmsg(15, {msg_name(0)=NULL, msg_iov(1)=[{"l\2\1\1\v\2\0\0\353\342\1\0.\0\0\0\10\1g\0\1s\0\0\5\1u\0\234\310\0\0"..., 2048}], msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 587
recvmsg(15, 0x7ffe2dec7320, MSG_CMSG_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
open("/etc/udev/udev.conf", O_RDONLY|O_CLOEXEC) = 18
fstat(18, {st_mode=S_IFREG|0644, st_size=49, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff94e619000
Comment 21 Christoph Feck 2017-09-25 20:17:37 UTC
*** Bug 384501 has been marked as a duplicate of this bug. ***
Comment 22 Chris Holland 2017-11-04 20:40:59 UTC
Dolphin is "slow" to launch >= 1000ms on an SSD.
So I tried to breakdown the pain points.

Tested by adding: qCDebug(DolphinDebug) << "mark1";
between statements and running: dolphin 2>&1 | ts "[%.S]"

* [main.cpp] new QApplication() takes 50ms
* [dolphinmainwindow.cpp] new DolphinViewActionHandler() is pretty slow. It calls DolphinViewActionHandler::createActions() in the constructor, which takes 140ms.
    * [dolphinviewactionhandler.cpp] The bulk of which is taken up by the "#ifdef HAVE_BALOO    Baloo::IndexerConfig config;" statement (probably file IO) which takes 134ms.
* [dolphinmainwindow.cpp] setupDockWidgets takes 100ms
* [main.cpp] mainWindow->openDirectories takes 250ms
* [main.cpp] DolphinMainWindow::show() takes 150ms
Comment 23 dm 2018-01-19 12:51:59 UTC
Hello,
Just went through this 'lag' on a clean Opensuse Leap 42.3 install.
- Happens on dolphin startup and Open/Save boxes in any KDE app
- not having such a lag on another hardware with similar software.
So went into personal notes (from years ago) and found something relevant.


Symptom : On laptops, some user actions (open dolph, right click on dolphin folder,...) produce a noticeable delay before UI responds.

Fact : Kdirlister spends significant time enumerating /sys (sub)folders

Fact : Unmounting SYSFS suppresses the lag (but breaks pretty much anything else).

Fact : Unloading 'battery' kernel module suppresses the lag.

Action : /etc/modprobe.d/99-local.conf
  options battery cache_time=60000

Question :
Why does KDE (core / framework / ...) have to "actively" (and "blockingly") query battery status, and probably other hardware stuff, on user actions ?
Could this be instead managed by a background KDE cache ?
Not a bug, but a serious UI responsiveness issue.
Comment 24 Clemens Eisserer 2018-02-15 19:43:37 UTC
I experience the same - Dolphin needs 1-2s to load on my 4Ghz Quad Core equipped with an SSD - and this is not caused by I/O, as subsequent starts are also slow.

Other file managers open almost instantly, I hope Dolphin can be brought to the same speed. Unbelievable Dolphin was once promoted as light-weight alternative to konqueror,
Comment 25 Guo Yunhe 2019-07-12 16:06:31 UTC
Not sure if I have the same issue:

When I first time launch Dolphin, it is slow (about 3 seconds). After that, launching Dolphin will be very fast (less than a second).

I have NVME SSD, Core i7 8550U, 32GB RAM.
Comment 26 Christoph Feck 2019-08-05 22:11:33 UTC
Guo, you might see the same Futex deadlock that is described at bug 409574. An strace log could confirm.
Comment 27 8192 2019-08-08 19:33:28 UTC
I also confirm this. Even on a PCIe SSD (on which apps seem to start much faster than on SATA), Dolphin occasionally takes around 3 seconds to launch. On SATA, it occasionally took up to 10 seconds. This was always random; usually, it launched fairly instantly.
Comment 28 David Rubio 2019-08-19 19:05:38 UTC
Can confirm this happens on an NVME SSD on Arch too. Had this issue on Pop!OS too. Clean install of Arch and it still happens. Slowdown is quite random, it starts instantly sometimes, but sometimes it takes as much as 10 seconds.
Comment 29 Guo Yunhe 2019-10-12 08:33:34 UTC
In my system, this issue seems disappeared for some time after upgrading. How about others?

Operating System: openSUSE Tumbleweed 20191009
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62.0
Qt Version: 5.13.1
Kernel Version: 5.3.4-1-default
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz
Memory: 31.1 GiB
Comment 30 Nate Graham 2020-01-31 19:57:17 UTC
*** Bug 416937 has been marked as a duplicate of this bug. ***
Comment 31 tagwerk19 2020-02-01 10:42:07 UTC
Info from Bug 416937 that might be appropriate her:

    At times Dolphin is very slow to start (and then to navigate). Whether launched from a link or the command line, it takes about a minute to start properly. The majority of the time it starts within a couple of seconds, then for no discernable reason it takes 30 seconds for Dolphin to appear on screen and another 25/30 seconds for the panel to be populated. This behaviour persists for some minutes and then goes back to normal. If you log out and back in again, the problem goes away. 

    No fixed or repeatable way of reproducing this. 

    Tested in a KVM guest under a 'test' username with a small number of user files. No mounts of other filesystems, local or remote. No tags defined. In this configuration, actively trying to provoke the bug, it happens one or twice a day.

    There's a screen recording and strace capture attached to Bug 416937
Comment 32 cf8c810d-4597-43d2-a19f-f1841b38123e 2020-12-14 06:11:30 UTC
*** This bug has been confirmed by popular vote. ***