https://bugs.kde.org/show_bug.cgi?id=452729

--- Comment #6 from Méven Car <meven....@kdemail.net> ---
(In reply to Harald Sitter from comment #5)
> This is the weirdest bug I've seen like ever. It's 100% reproducible and
> also not that hard to hit during regular use. Bumping bug importance
> consequently. Moving to KIO since I suspect there's a bug in there
> somewhere. This happens also with samba servers.
> 
> The easiest way to test is to simply copy a file from local to remote twice,
> i.e. have an overwrite on the second copy. `smbstatus -L` on the server
> should show that the file remains locked after the second copy and further
> copying will fail on the busy file.
> 
> What happens here ultimately is that mimeType() in the SMB worker never
> returns. Why that happens I don't understand.
> Specifically this is the result of a rather unfortunate chain of events:
> Something inside plasmashell (supposedly the progress notification) is
> causing a call to ::get() (supposedly for mimetype query) and that
> SMB::get() call never returns because it gets stuck on emitting mimeType(),
> which in turn is stuck because the Interface never replies with the correct
> CMD. Because mimeType() never returns, get() never returns, thus the open
> file is never closed and that is why the file is busy (i.e. open file =
> locked file = busy file = cannot be written to). 
> 
> I've tried to bisect this in KIO but that lead to
> 1306904f90b21b663e68a7dec4f67d81ef4fa11c which I don't see how it cause this
> other than incidentally enabling whatever it is inside plasmashell that
> causes the ::get() call.
> 
I guess the ksmserver/knotifications can now trigger mimetype from the QML like
for displaying icons.

> Needs someone who has the slave IPC loaded into brain.
> 
> David, Meven, thoughts?
> 

First check smb ioworker code.

```
[     0.000](5144)/(kf.kio.core) unknown: error() called twice! Please fix the
kioslave5 KIO slave
[     0.000](5121)/(default) unknown: ""
[     0.000](5395)/(kf.kio.core) unknown: error() called twice! Please fix the
kioslave5 KIO slave
```
We have those traces and it points towards the ioworker.

Something I noticed in get() for instance, if the file reads fails the job
emits error and finished even returning processed(st->size);

A naive patch would be:
--- smb/kio_smb_file.cpp
+++ smb/kio_smb_file.cpp
@@ -106,6 +106,8 @@ void SMBSlave::get(const QUrl &kurl)
     }
     if (future.get() != KJob::NoError) { // check if read had an error
         error(future.get(), url.toDisplayString());
+        closeWithoutFinish();
+        return;
     }

The job returning error and finished and processedSized but not mimetype might
cause calling code to stall, or retry.
If several mimetype() are called at the same time might cause the same issue.

It might explain your overwrite file case: we might be writing to a file and
trying to gets its mimetype, that's bound to fail until 1024 bytes are written
at least, or because the size of data returned exceeds the size of the buffer.

I am not very confident about this hypothesis, I haven't checked it.

Something interesting to do, is to compare with nfs ioworker.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to