Bug 396630

Summary: stop thumbnailing when renaming/moving a file (over smb)
Product: [Frameworks and Libraries] frameworks-kio Reporter: Martin Samek <mr>
Component: generalAssignee: David Faure <faure>
Status: CONFIRMED ---    
Severity: normal CC: bugseforuns, gudvinr+kde, kdelibs-bugs, nate, sitter, tim.eberhardt
Priority: NOR Keywords: usability
Version: 5.67.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: error message when rename a file in a samba share fails
failure on video deleting
failure on renaming jpg and png files

Description Martin Samek 2018-07-18 12:53:16 UTC
There is some ugly bug in the kio_smb component. I can't rename files in SMB share. I can create them, delete them, but rename fails. This bug also affects copying files to the SMB share because they are named "filename.part" at first and at the end of the transfer renamed to the real name. This rename also fails.

How to debug this?
Comment 1 Patrick Silva 2018-07-26 14:43:45 UTC
Created attachment 114149 [details]
error message when rename a file in a samba share fails

Do you see an error message like shown in my screenshot when you try to rename a file?
Comment 2 Patrick Silva 2018-09-14 14:21:18 UTC
(In reply to Dr. Chapatin from comment #1)
> Created attachment 114149 [details]
> error message when rename a file in a samba share fails
> 
> Do you see an error message like shown in my screenshot when you try to
> rename a file?

bug persists on Arch Linux, kio-extras 18.08.1.
Comment 3 Martin Samek 2018-10-23 07:48:20 UTC
bug persists on Gentoo, kde-apps/kio-extras-18.08.2

any idea how to debug this?
Comment 4 Tim Eberhardt 2019-01-24 11:24:55 UTC
Reproduceable on openSUSE Tumbleweed with v18.12.0 (but already had this error in previous versions)
Comment 5 Patrick Silva 2019-07-31 19:08:04 UTC
This annoying problem persists.

Operating System: Arch Linux 
KDE Plasma Version: 5.16.4
KDE Frameworks Version: 5.60.0
Qt Version: 5.13.0
Comment 6 Nate Graham 2019-11-29 20:57:10 UTC
This is working for me with Frameworks 5.65. Can anyone confirm?
Comment 7 Patrick Silva 2019-11-30 14:38:26 UTC
still reproducible
open dolphin settings, "previews" tab
set "skip previews for remote files above" to 5000 mb
open a samba share containing video files
try to rename a video
renaiming fails

the problem occurs even if preview feature of Dolphin is disabled.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.17.80
KDE Frameworks Version: 5.65.0
Qt Version: 5.13.2
Comment 8 Nate Graham 2019-12-02 05:01:15 UTC
Weird, works fine for me.
Comment 9 Harald Sitter 2020-02-07 15:42:30 UTC
What type of servers do you see this problem with? I could totally imagine windows locking the file while something is reading it, perhaps even samba.

Also, do you see this with small files as well?

That said, I too cannot reproduce it, buuuut, for very large files thumbnailing seems to not kick in despite raising the remote limit. But, assuming the thumbnailer were to kick it I really would not be surprised if that were to interfere with renaming. That would make this a dolphin/KIO bug though. File "consumption" ought to be terminated before a move operation can be done.
Comment 10 Patrick Silva 2020-02-07 20:16:52 UTC
I can reproduce with Dolphin 19.12.2 on Arch Linux, but only if previews feature of Dolphin is enabled.
It happened when I tried to rename a 33 MiB video. I also tried to rename several jpg files while Dolphin was generating their thumbnails, but renaming was successful in these cases.
My server is also Arch Linux.

Operating System: Arch Linux 
KDE Plasma Version: 5.17.90
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.1
Comment 11 Harald Sitter 2020-02-10 10:47:10 UTC
So, I an reproduce this by streaming a file (i.e. having an open file descriptor) and then trying to rename that file which errors out EBUSY since the file is busy and cannot be written to. Which is indeed kind of expected and combined with the fact that you see this problem when enabling thumbnailing I am guessing that the thumbnailing isn't getting killed before the rename is attempted.

Thumbnailing is controlled by KIO directly, I think. Moving the bug there.
Comment 12 Tim Eberhardt 2020-02-21 10:31:01 UTC
I can confirm this bug with previews enabled AND disabled.
Always happens to me if I open a document on a share, modify it and try to reupload it to the share. This always ends in a document_name.ext.part file which I can not rename to just *.ext. I can delete it but reuploading would result in the same situation. Only solution is to rename it on another machine. Very annoying...

Frameworks v5.67.0 (but had this bug for a longer time now as mentioned in comment #4)
Dolphin v19.12.2
Comment 13 Harald Sitter 2020-02-21 11:09:37 UTC
Please provide a step-by-step guide of what you do to cause this.
Comment 14 Tim Eberhardt 2020-02-21 11:16:19 UTC
- open dolphin and go to a folder on a smb share
- open a document (.xls file in LibreOffice in my case)
- modify document and save it
- dialog to upload the changed document opens
- click to upload the document and overwrite the existing one
- error message that indicates the file could not be copied correctly (with retry, cancel... buttons)
- retrying gives same result
- click cancel and find the file with .part extension on the share
- trying to remove .part ext is impossible with dolphin
Comment 15 Harald Sitter 2020-02-21 12:16:53 UTC
I still cannot reproduce this. What's more the save feature you see is KIO "mimicking" remote access. KIO downloads the file into a local cache, libreoffice saves to that cache, KIO detects the change and wants to upload the newly changed file to the server again. KIO would have no reason to have the file open on the remote in that scenario, so it'd make no sense that the rename fails.

What distribution + version are you on?
And what type of smb server is it, and what version?
Comment 16 Tim Eberhardt 2020-02-21 12:29:28 UTC
I come from opensuse tumbleweed (first posting) and am now on sabayon linux. The server is a opensuse leap server with samba 4.6.16. Renaming files with a client with xfce is working (as well as with windows clients).
Comment 17 Tim Eberhardt 2020-02-21 12:40:38 UTC
I have found the solution to my problem now:
setting

client max protocol = NT1

in smb.conf resolves the problem. Maybe kio should use that as a default?
Comment 18 Patrick Silva 2020-04-07 20:55:46 UTC
Created attachment 127372 [details]
failure on video deleting

Also it's inpossible to delete a video while Dolphin generates its thumbnail.
Dolphin says "Internal error. Send a full bug report bla bla bla".

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.1
Comment 19 Harald Sitter 2020-04-08 13:29:33 UTC
Yep. That'd be consistent with the theory that the problem is the thumbnailer reading (and thus holding a lock on the file). You can do pretty much nothing that would change the file while that is the case.
Comment 20 Patrick Silva 2020-05-26 13:08:38 UTC
Created attachment 128803 [details]
failure on renaming jpg and png files

Renaming of jpg and png files while their thumbnail is generated also fails.

Operating System: Arch Linux 
KDE Plasma Version: 5.18.90
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0 rc2
Comment 21 Harald Sitter 2023-01-11 16:08:50 UTC
*** Bug 464009 has been marked as a duplicate of this bug. ***