#941130 thunar: delay/hang at startup with lots of files in XDG_TEMPLATES_DIR

Package:
thunar
Source:
thunar
Description:
File Manager for Xfce
Submitter:
Tim Marston
Date:
2019-09-26 11:33:03 UTC
Severity:
normal
#941130#5
Date:
2019-09-25 11:49:00 UTC
From:
To:
Dear Maintainer,

Setting XDG_TEMPLATES_DIR in ~/.config/user-dirs.dirs to point to a
directory with a lot of stuff in it (other than $HOME, it seems) causes
delays to Thunar startup that can very easily spiral in to minutes,
hours...

Issue was not present before xfce 4.14 update.

#941130#10
Date:
2019-09-25 18:36:38 UTC
From:
To:
Does it depend on the content of the folder? Is there a specific file in that
folder which makes Thunar choke on it or something? Does stracing the Thunar
process gives a bit of information?

Regards,

#941130#15
Date:
2019-09-25 21:49:39 UTC
From:
To:
Hello

I have the same problem with XDG_TEMPLATES_DIR pointing to $HOME/Desktop
(I didn't want random programs to create a useless $HOME/Templates).

I can't find a single file causing the issue, but my home contains some
subdirs with cross-symlinks causing recursive loops (it's basically a copy
of /sys/devices/system/{node,cpu} contents).
Thunar grows to 2GB of resident memory and doesn't seem to ever end
(I killed it after several minutes) with those 2500 files/dirs/symlinks.

If I remove those files and create 100 subdirs with 100 files each,
Thunar starts reasonably quickly (3-4 seconds).
If I create a symlink to a grandparent directory in there, the issue
comes back.

So in my case, it looks like the issue is Thunar not handling recursive
symlinks properly in the template directory.

Brice

#941130#20
Date:
2019-09-26 10:51:18 UTC
From:
To:
Hi,

With 4000 files totalling ~4GB, startup time is ~2s.
With 8000 files totalling ~8GB, startup time is ~4s.
With 16000 files totalling ~16GB, startup time is ~8s.

Therefore, delay seems proportional to the number of files.

With 4000 files totalling ~4GB, startup time is ~2s.
With 4000 files totalling ~8GB, startup time is ~2s.
With 4000 files totalling ~16GB, startup time is ~2s.
With 4000 files totalling ~32GB, startup time is ~2s.

Therefore, delay doesn't seem proportional to file size, particularly.

With 16000 html files (~65MB), startup time is ~7s.
With 16000 text files (~65MB), startup time is ~7s.
With 16000 pdf files (~1.9GB), startup time is ~5s.
With 16000 png files (~257MB), startup time is ~5s.

Therefore, file type does seem also to have an effect.

Strace output just shows Thunar ploughing through the files!

#941130#25
Date:
2019-09-26 11:29:37 UTC
From:
To:
Well, so I don't think there's really a bug here, same kind of thing would
happen when opening that folder in Thunar anyway, it's just that template dir
is a bit special because it will happen every time Thunar is started. By the
way, does it happen every time a Thunar window is opened or only when the
Thunar daemon is started?

Also, the behavior might have slightly changed with the GTK-3 rewrite.

In any case, it looks to me like a case of “it hurts to do that, so don't do
it”. If you need templates, then have a specific folder with only the
templates files you need. If you don't, the way to disable it is supposedly to
set it to $HOME using:

xdg-user-dirs-update --set TEMPLATES ~

or editing .config/user-dirs.dirs


Regards,