Bug 363185 - file selection dialog very slow when samba shares are not present
Summary: file selection dialog very slow when samba shares are not present
Status: CONFIRMED
Alias: None
Product: kdialog
Classification: Applications
Component: general (show other bugs)
Version: 1.0
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-17 16:10 UTC by Romain Bazile
Modified: 2018-04-04 10:55 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Bazile 2016-05-17 16:10:28 UTC
I have two samba shares defined in my /etc/fstab:
//192.168.0.69/DataHere            /run/media/username/DataHere cifs credentials=/home/username/.sambacreds,x-systemd.automount,uid=username 0 0
//192.168.0.70/DataThere  /run/media/username/DataThere cifs credentials=/home/username/.sambacreds,x-systemd.automount,uid=username 0 0

Whenever I start my computer and those two shares are not on my network (for example at work vs at home), the file dialog selection becomes very slow and almost unusable.
This means when I want to do "save as" from Firefox or Thunderbird, or any other program (LibreOffice or Kate also), the dialog is very slow, either when I want to navigate through the folders, select a file, or change the name.

When I'm connected to those samba shares, the dialog works flawlessly and is fast.

I will do more tests to see if suspend/waking the computer helps with the issue or worsen it, or with moving the computer back and forth between the two places.

Reproducible: Always

Steps to Reproduce:
1. Define samba shares in /etc/fstab
2. Make sure they are not present on the network
3. Open a save file or open file dialog (from Firefox or Kate)

Actual Results:  
File selection dialog is very slow, and unresponsive for several dozens of seconds

Expected Results:  
File selection dialog should be fast

I'm using an Arch Linux Derivative, Manjaro, up to date as of today (2016 May 17).
Comment 1 Romain Bazile 2016-05-17 16:12:21 UTC
I think this could be linked to the file dialog trying to connect to the shares to evaluate the free space available in those places.
Comment 2 Romain Bazile 2016-05-23 09:03:54 UTC
More information!
As soon as I unmount both shares (with 'umount /run/media/username/DataHere' for example), the file selection dialog is fast again!
The problem appears even when I cold boot the computer somewhere where I don't have the connection to the servers.
Comment 3 Romain Bazile 2016-12-23 20:47:57 UTC
I changed the concerned module. The problem can be reproduced by calling 'kdialog  --getopenfilename'.
Also, I ran an strace on the call.
A lot of calls are made and are all the same.

More specifically this sequence is repeated continuously:
ioctl(10, FIONREAD, [32])               = 0 <0.000021>
read(10, "\2\0\0\0\2\0\0\0\0\0\0\0\20\0\0\0logkdialog2\0\0\0\0\0", 32) = 32 <0.000023>
recvmsg(6, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable) <0.000023>
poll([{fd=3, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=13, events=POLLPRI}, {fd=14, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}], 11, 0) = 1 ([{fd=10, revents=POLLIN}]) <0.000028>
recvmsg(6, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable) <0.000022>


If the calls are counted I get this results:
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 30.91    0.000017           0      1213       821 recvmsg
 27.27    0.000015           8         2           wait4
 20.00    0.000011           0      2099       206 stat
 10.91    0.000006           0       652           fstat
 10.91    0.000006           0      2806      1650 access
Comment 4 Anton Latuha 2017-05-18 22:54:32 UTC
Somebody, please take notice.

My additional information.
In Firefox it loads eventually, after ~30 seconds, in Chromium seems completely not.

And I do have disconnected NFS now.

Dolphin also freezes completely, when I click that NFS folder.

It is also reported for Kdialog in:
Bug 323650
Bug 340584
Bug 354694
Bug 340584

And in Kfile Bug 320560
And in Dolphin Bug 357509
Comment 5 Anton Latuha 2017-05-18 22:58:57 UTC
People please vote for this bug.
Comment 6 Toni Asensi Esteve 2018-02-13 20:24:17 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Frederick Zhang 2018-03-30 15:02:49 UTC
And actually Kdialog and Dolphin often cause my sleeping disks to be spun up, which is a bit irritating...

So can we 1. avoiding scanning network drives for any info unless needed 2. asynchronously load info of network drives, so it won't block the UI?
Comment 8 Frederick Zhang 2018-04-04 10:55:54 UTC
And by the way, even the application launcher would lag if you have any files from a samba share in the history tab...