! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Trashing many files causes Thunar to hang
Status:
RESOLVED: MOVED

Comments

Description fuank 2019-08-22 18:21:19 CEST
When moving dozens of files to trash, and while having lots of files already sitting in the .Trash directories, gvfsd-trash uses 100% of CPU, and Thunar also uses a lot of CPU for minutes while being unresponsive.

I first thought this was a bug with gvfsd, which I have filed a report there: https://gitlab.gnome.org/GNOME/gvfs/issues/416. 

It turns out it may just be the way Thunar generates a lot of requests to gvfsd. Please see the linked issue for more details. 

Apparently Thunar would need the same fix as Nautilus to avoid generating requests to gvfsd-trash within a short amount of time ( https://github.com/xfce-mirror/thunar/blob/master/thunar/thunar-trash-action.c )
Comment 1 alexxcons editbugs 2019-08-22 22:53:04 CEST
Thanks for reporting !
I will have a look into it when I have time.
Comment 2 DarkTrick 2019-09-06 12:28:07 CEST
Encountered same issue.
Comment 3 alexxcons editbugs 2019-09-06 23:59:42 CEST
About which numbers we are talking here ?

I just moved 2000 files into trash to "prefill" it, and than added another 100.

The first 2000 took a small while. But the 100 afterwards went real quick for me.

Edit: Uh, wait, I just tried to trash another 100 when tree-view is open: Seems like we have a tree-view bug here.
Comment 4 alexxcons editbugs 2019-09-07 00:01:16 CEST
Can you reproduce the bug as well on bookmark view ? For me it only happens on tree-view.
Comment 5 fuank 2019-09-07 00:33:24 CEST
Seems to happen both with shortcuts and tree view for me.
Comment 6 DarkTrick 2019-09-07 07:47:47 CEST
My stats: I had about 12000 items in trash (about 1GB). 

Adding another 3000 items (60MB in total) produced this behaviour.

Treeview in the left sidebar is enabled.
Main view is "detailed list".
Comment 7 DarkTrick 2019-09-07 07:56:54 CEST
I just tried to empty my trash ( 15000 item; about 1GB)
and it raised the CPU to 100% on i5 quad(?) core. I canceled the process after about 1.5 minutes.
Thunar also start to hang. 

Maybe as a hint:
using trash-empty ( package: trash-cli ) did the job in a very smooth and fast way.
Comment 8 fuank 2019-09-08 05:09:42 CEST
On Arch Linux I use "gio trash --empty" which is very fast, unless Thunar is running, in which case it will hang and use a lot of CPU as it's probably monitoring the trash directories. So using that or using Thunar's empty trash shortcut gives the same problem.
Comment 9 alexxcons editbugs 2019-09-08 18:59:05 CEST
Created attachment 9014 
WIP patch

(In reply to fuank from comment #8)
> On Arch Linux I use "gio trash --empty" which is very fast, unless Thunar is
> running, in which case it will hang and use a lot of CPU as it's probably
> monitoring the trash directories. So using that or using Thunar's empty
> trash shortcut gives the same problem.

That was an excellent hint, thanks !
I tried to diable different thunar file monitors, and found out that the "bookmark_monitor" makes a big difference for me when executing "gio trash --empty".

I am not sure why two different files create a "bookmark monitor" ... possibly that is the problem.

Before checking details, could you please try if the attached patch fixes the bug for you ?
(No bookmark monitor at all)
Comment 10 fuank 2019-09-08 22:35:08 CEST
Thanks alexxcons. I have tested again (without your patch) in 1.8.9 (release) and you are right, this only occurs with tree view active. 

However, even with your patch applied (with latest commit 47b32e784823a706f47a3188b258b803160c2426), the issue still happens with tree view.
Comment 11 alexxcons editbugs 2020-04-05 23:58:43 CEST
Take a try for the patch on this bug: https://bugzilla.xfce.org/show_bug.cgi?id=16641  .. very promising
Comment 12 alexxcons editbugs 2020-04-06 00:37:00 CEST
Uh, wait, not related .. this bug is about moving to trash, the other one is about permanent deletion
Comment 13 alexxcons editbugs 2020-05-11 00:38:09 CEST
.. just found a duplicate of this bug, which isolder .. so I will close this one

*** This bug has been marked as a duplicate of bug 12635 ***
Comment 14 alexxcons editbugs 2020-05-11 15:11:35 CEST
Sorry, I was to fast with closing it a a dup. Bug #12635 seems to be not related to tree-view
Comment 15 fuank 2020-05-11 18:18:38 CEST
The solution is to simply rate limit requests made to gvfs-trashd whenever a change occurs in the trash directory, as they did in Nautilus here: https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/57/diffs

So a fix would most likely be implemented in that file: https://github.com/xfce-mirror/thunar/blob/master/thunar/thunar-trash-action.c
Comment 16 fuank 2020-05-11 23:32:00 CEST
My comment was perhaps a bit hasty. After looking closer it might not be as straightforward as I made it sound.

I'm not sure why the callback thunar_trash_action_changed() seems to be called twice for every change of the trash state. Might be due to thunar_file_watch(trash_action->trash_bin) (https://github.com/xfce-mirror/thunar/blob/c5b2663c8fca74f9e191c56bc39e969f82752801/thunar/thunar-file.c#L3981) which triggers the second call or something.

I've tried hacking around a bit but things are beyond my understanding right now.
Comment 17 alexxcons editbugs 2020-05-12 22:25:31 CEST
You might want to take a try for this branch: https://github.com/alexxcons/thunar/tree/ReplaceGtkAction45

There is no thunar_trash_action any more, GtkActions got completely replaced .. can you still reproduce ?

... hopefully I will be able to merged that branch into master soon .. working on that currently
Comment 18 Git Bot editbugs 2020-05-26 23:45:17 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/thunar/-/issues/259.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #15871

Reported by:
fuank
Reported on: 2019-08-22
Last modified on: 2020-05-26

People

Assignee:
alexxcons
CC List:
3 users

Version

Attachments

WIP patch (1.84 KB, patch)
2019-09-08 18:59 CEST , alexxcons
no flags

Additional information