ghost files remain after moving files

Bug #1768521 reported by slumbergod
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Thunar File Manager
Fix Released
Medium
thunar (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

An old bug still persisting in thunar.

Move files. Most disappear from the source window but frequently the last one remains as a ghost file. You have to manually refresh the view to remove it.

The window should refresh itself after the transaction is completed.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: thunar 1.6.15-0ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Uname: Linux 4.15.0-20-generic x86_64
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
Date: Wed May 2 07:33:25 2018
InstallationDate: Installed on 2018-04-27 (5 days ago)
InstallationMedia: Xubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
SourcePackage: thunar
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
In , Slumbergod-n (slumbergod-n) wrote :

While 1.6.11 seems to have fixed the crashing issues, this bug is still present for me.

To replicate, move a bunch of files out of a directory.
The last one to be moved looks like it hasn't been moved because their is a ghost entry still present in the detail view.
Ctrl+R to refresh the view removes it but the reload should be triggered automatically.

Revision history for this message
In , Kev Bowring (flocculant) wrote :

Confirmed seeing this - in fact I moved a 'bunch' of files and all the moved files were apparently still in the source folder till reload

Revision history for this message
In , Will (lightningw9) wrote :

I have seen this using icon view. It is not consistently doing it though; sometimes it was fine, sometimes 1 or 2 files would remain visible. I guess it is a threading issue.

Revision history for this message
In , Slumbergod-n (slumbergod-n) wrote :

Actually, I forgot to add that I only use Detailed View and the bug is definitely present there.

Revision history for this message
In , Kev Bowring (flocculant) wrote :

Compact view ...

I've seen also where a file gets added to an already opened instance of thunar at the correct location - nothing is there until I reload.

Revision history for this message
In , Kev Bowring (flocculant) wrote :

Created attachment 7048
unrefreshed thunar

At the point when I stopped zsync Thunar should show these files:

zesty-desktop-amd64.iso
zesty-desktop-amd64.iso.zs-old
zesty-desktop-i386.iso
zesty-desktop-i386.iso.part

Revision history for this message
slumbergod (slumbergod) wrote :
Revision history for this message
slumbergod (slumbergod) wrote :

I decided to add the experimental PPA for Bionic 18.04 so I could see if this bug (and several others) has finally been resolved with Thunar 1.8.1

Unfortunately, it has not.

Selecting two or more files and moving them to another directory usually leaves a ghost file of one of them. A manual refresh is still required to remove the ghost file.

Revision history for this message
In , Ilya (ivkol) wrote :

still appears, XFCE 4.12

moving files. After moving in thunar source window shows one file that is still not moved. But actually it is moved and not exsist in source.
Compact list view.

Revision history for this message
In , Slumbergod-n (slumbergod-n) wrote :

still present in thunar 1.8.2.
It also happens when extracting an archive.
The archive might extract a folder, then rename it the temporary one and you end up with an incorrectly named folder requiring a refresh to see the renamed one.

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

Can reproduce the problem. Happens for all views, not only detailed view.

+

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

- create some empty files in some folder
- move them out of the folder (either by cut + paste, or via drag & drop. will be the same result )

Changed in thunar:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Slumbergod-n (slumbergod-n) wrote :

I'm now using Thunar 1.82 in the Xubuntu test ppa. The bug is still present. In fact, it is worse if anything. There is ALWAYS a ghost file left after moving files.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in thunar (Ubuntu):
status: New → Confirmed
Revision history for this message
In , Theo Linkspfeifer (lastonestanding) wrote :

This pretty much always happens when moving two or more files via drag and drop from Thunar to the desktop. I tried to debug the issue and noticed that removing the following if block helps: https://git.xfce.org/xfce/thunar/tree/thunar/thunar-folder.c#n607

Revision history for this message
In , Theo Linkspfeifer (lastonestanding) wrote :

*** Bug 14704 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

> removing the following if block helps: https://git.xfce.org/xfce/thunar/tree/thunar/thunar-folder.c#n607
Good spot ! I can confirm that removing the block helps (= removing the whole method).

A bit obscure: Removing just the "if" contition ( always executing "thunar_folder_reload") as well helps.

I'll further investigate to understand whats going on here.

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

- Removing "thunar_folder_file_changed" is not an option, because like that, "mv test1 test2" in an open folder will not be recognized by thunar.

- Removing only the if (G_UNLIKELY (folder->corresponding_file == file)) is as well bad, since this will cause many unnecesarry folder reloads.

The Problem comes from "thunar_folder_reload" beeing executed repeatedly.

Each reload stops a job and than starts a new job. A stopped, stopped/unfinished job may lead to:
(thunar:2655): thunar-CRITICAL **: thunar_folder_finished: assertion 'folder->content_type_idle_id == 0' failed
That will cause the view to dont update.

... to be further investigated

Revision history for this message
In , Hjudt-l (hjudt-l) wrote :

Last time I worked on thunar code, that reload stuff was a big mess and did not even work for jobs (copying, moving files). What makes it more complicated is that there are folder reloads and file reloads. I couldn't fix it completely, and if you change one part, it often breaks the other parts. I believe the proper solution would be to create a reload queue that gets processed regularly (e.g. while idle) and confined to a single place. That way, reloads could also be prioritized if necessary and perhaps unneeded/duplicate reloads could even be avoided (network accesses for example are quite expensive regarding performance). It could be more complicated than the current implementation, but the current implementation looks also complicated and is hard to understand, so maybe it doesn't matter.

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

Thanks for that hint !

Before going for a central reload queue, I'll see if I can find a more simple fix.

My plan would be to add a minimal delay before doing a reload of a specific thunar-folder (via g_timeout_add). And after that delay, only the latest "reload trigger" is considered, so that burst-triggers only result in a single reload.

.. will see if I can come up with some patch soon. (hopefully not breaking something else ;)

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

Created attachment 8658
patch

Attached a patch to fix the concrete bug .. the approach seems to work suprisingly well.

Possibly it makes sense to use the same burst prevention for other "reload" triggers on other thunar components.

I randomly picked a delay of 100ms. However burst prevention as well seems to work fine with 10ms, or only 1ms delay .. any preferences ?

Would be great to have some more testers before I push this fix.

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

> However burst prevention as well seems to work fine with 10ms, or only 1ms delay
Wrong: On 1ms it happens occasionally that there is still a ghost file. On 10ms it happens very seldom. On 100ms so far I did not see any ghost file so far. So 100ms seems to be okish. Probably the minimum depends on hardware.

Revision history for this message
In , Theo Linkspfeifer (lastonestanding) wrote :

The patch fixes my test case in comment #11.

Changed in thunar:
status: Confirmed → In Progress
Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

Thanks for testing !
Before commit, I will try as well some other approach, since my current fix feels a bit squishy (depends on a magic number)
Strictly seen, my patch fixes a different problem (bursts). The patch just makes this bug harder to appear (and harder to reproduce).

Revision history for this message
In , Kurakin Alexander (kuraga333) wrote :

*** Bug 15324 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

Created attachment 8693
a better patch

The actual problem of the ghost files is triggered because the used FileMonitor is destroyed and re-created on each "thunar_folder_reload". Because of that, some notifications of the FileMonitor are lost, leading to missing folder reloads.

While trying to figure out why one would want to destroy the FileMonitor on each folder_reload, I found that we currently use a deprecated FileMonitor flag "G_FILE_MONITOR_SEND_MOVED".
See details here: https://developer.gnome.org/gio/stable/GFile.html#G-FILE-MONITOR-SEND-MOVED:CAPS

Since sooner or later we need to exchange this flag, I just did so (See patch) to my suprise fixing the deprecated enum item as well fixed this bug.

However I dont fully understand the new functionallity yet, since it looks like only "G_FILE_MONITOR_EVENT_MOVED_OUT" is triggered, the other are not, while it looks like there are no regressions.

On top I still need to figure out if it makes sense at all to destroy and re-create the FileMonitor.

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

Created attachment 8745
Finally a proper patch

The last patch I posted had the downside that it required GIO v2.46 to work, so it is not possible to apply it to 1.8.x .. even for thunar master it would require a GIO bump. (besides that it does not fix the actual problem)

Attached a patch which fixes the actual problem, which is the permanent re-creation of the file monitor on each refresh of the folder.

The patch as well removes a single, superfluos "thunar_file_reload" which caused trouble when left there.

May I ask you to take another try for this new patch ? I did all testing which came to my mind .. but you never know ... possibly you have some exotic network file-systems around for testing ?

Revision history for this message
In , Theo Linkspfeifer (lastonestanding) wrote :

This new patch resolves the issue too. I did not test anything special other than my mentioned test case.

Revision history for this message
In , Gitbot (gitbot) wrote :

Alexander Schwinn referenced this bugreport in commit c53d11d9b1b948da7e266dc1cc3cc7d9602f42bd

Dont restart the folder monitor on each refresh - Fixes "ghost files after moving files" (Bug #13364)

https://git.xfce.org/xfce/thunar/commit?id=c53d11d9b1b948da7e266dc1cc3cc7d9602f42bd

Revision history for this message
In , Gitbot (gitbot) wrote :

Alexander Schwinn referenced this bugreport in commit bf4c333dbca1de6cd384e68a5caff027808a48bd

Dont restart the folder monitor on each refresh - Fixes "ghost files after moving files" (Bug #13364)

https://git.xfce.org/xfce/thunar/commit?id=bf4c333dbca1de6cd384e68a5caff027808a48bd

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

Thanks for testing !

I moved the creation of the folder->monitor into the constructed, since it is anyhow only created once, gave it some more testing, and now pushed it to master and 4.14

Actually I as well wanted to push to the 4.12 branch, but I just realized that it there seems to be some bug for this branch, giving me a blanc thunar window on starting it.

Will push to 4.12 later, when I found out what causes that extra-wiredness.

Revision history for this message
In , Gitbot (gitbot) wrote :

Alexander Schwinn referenced this bugreport in commit 3e78c775d0cb6185b39172d211ef0a7ac5ebaf27

Dont restart the folder monitor on each refresh - Fixes "ghost files after moving files" (Bug #13364)

https://git.xfce.org/xfce/thunar/commit?id=3e78c775d0cb6185b39172d211ef0a7ac5ebaf27

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

Pushed for 4.12 as well ... was some system wide glitch on my side.

I just realized the via a sftp connection, all files will remain as ghost files after moving them one folder up.
It's not a regression, was like that before.

I'll open a new bug for it and see if there is a simple fix.

Revision history for this message
In , Kurakin Alexander (kuraga333) wrote :

Thanks very much!

> I'll open a new bug for it and see if there is a simple fix.

I hoped that's the same bug :(

Changed in thunar:
status: In Progress → Fix Released
Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

(In reply to Alexander Kurakin from comment #30)
> I hoped that's the same bug :(

It's something different for sure. See the details here: Bug#15704

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

*** Bug 14755 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Alexxcons-x (alexxcons-x) wrote :

*** Bug 14754 has been marked as a duplicate of this bug. ***

Revision history for this message
Si Dedman (si-dedman) wrote :

Still getting this on v1.8.14 fresh install. Didn't have it on previous build - could have sworn there was a fix, something to do with cache amount or time or something...

Currently if I drag items out of a folder they remain there until I manually refresh.

Revision history for this message
Kanehekili (jentiger-moratai) wrote :

Just installed fresh Linux Mint 20.1 XFCE. With Thunar v1.8.14 the problem persists:

Moving a file from local to mounted smb share (two thunar windows) and then back again works: refresh ok.
Moving a file from remote to a bookmark (e.g. Documents) will not trigger a refresh on the mounted drive/share. (Only one Thunar instance involved)
Locally the move from "List" to "Bookmark" works

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.