Gvfsd-trash maxing out 1 CPU thread

Hello,
i am running 5.13.5-1-MANJARO with up to date XFCE and Dolphin file manager, this is the process that is using 1 CPU thread roughly: (112% momentarily):

CPU% MEM% VIRT RES PID USER TIME+...
112   0.1   585M  57.6M    2676 user       82h31:27 3     0 R    0 0    /usr/lib/gvfsd-trash --spawner :1.5 /org/gtk/gvfs/exec_spaw/0

Please what to do about this to prevent long term usage of the CPU by this process?

Hello,

This can happen (happened in the past) when your trash has a lot of deleted local files mixed with external mount points deleted files or cloud clients deleted files, ending up in some process that is generating too many requests for gvfsd-trash

Go to ~/.local/share/Trash/files/ and also go to ~/.local/share/Trash/info/ and empty the content. On GTK+ DEs there is usually also the ~/.local/share/Trash/expunged/ folder that AFAIK is not something Dolphin handles, but rather should empty itself after a reboot or two.

You can remove their content by:

rm -rf ~/.local/share/Trash/expunged/* ~/.local/share/Trash/files/* ~/.local/share/Trash/info/*

Also look for the .Trash-1000 folder in your mounted partitions and check if they have the proper folders as mentioned above, and if there are files in them.

3 Likes

Thank you for a nice answer (not that it would be the solution of this issue/bug - but rather workaround that i have to remember or script somehow), i see that the process activity is gone (ended itself without my action overnight).

look for the .Trash-1000 folder in your mounted partitions

i did: for path in $(find / -type d -name .Trash-1000 2>/dev/null); do echo "$path":;find "$path" -type f|wc -l 2>/dev/null; done

only significant folders found was:
/a/.Trash-1000: - 533 files (5,7G)
/b/.Trash-1000: - 261568 files (151G)
(sizes discovered using du -h --max-depth=0 …)

/a /b are mountpoints of the ZFS filesystem the .Trash folders contains expunged,files,info dirs.

The Trash in Dolphin file manager (trash:/) shows files worth 8GiB but Thunar trash:/// shows “only” 43527 files (not 261K files as “du”) but correct 169GiB size same as Linux “du” returned for all mountpoints)

I am not Linux expert so the mechanism of handling soft-deleted files on ZFS mountpoints i do not understand. I thought it would be visible in “global” trash, but at least Dolphin seems confusing in this regard. In Thunar i have tried to select all trashed items, right click and properties, i can not see any overview :-/. Feedback on how to handle soft-deleted files on various mountpoints is welcome.

i would welcome feedback to what i posted. Because Manjaro continue to waste my CPU i have tried to delete contents of the .Trash-1000 subfolders on one of the two ZFS mountpoints.

Then i tried to delete whole .Trash-1000 folder and deleted a certain file on same mountpoint using Dolphin file manager, file was placed into main Trash on system drive. Thunar file manager though caused file to be placed on mountpoint’s trash, not to system trash. Though none of the two allow me to empty the mountpoint’s trash or restore file by right clicking it (Dolphin has Edit/Undo trash, but it just warns “A file named /b/.Trash-1000 already exists.”). These are ZFS mountpoints as said.

Btw if one prefer to have relocated even mountpoint files to the system drive trash (for simplicity because sys. trash actually works and allow restore etc.), maybe one can add symlink like:
ln -s /mnt/disk/.Trash-1000/ ~/.local/share/Trash/
(possibly wont work until both are deleted?)