Bug 386246 - File transfer does not complete
Summary: File transfer does not complete
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: common (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-27 12:24 UTC by BingMyBong
Modified: 2017-12-19 23:00 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
This file does not work (398 bytes, image/png)
2017-11-19 23:56 UTC, Nicolas Fella
Details
This file does work (1.37 MB, image/png)
2017-11-19 23:57 UTC, Nicolas Fella
Details

Note You need to log in before you can comment on or make changes to this bug.
Description BingMyBong 2017-10-27 12:24:50 UTC
Just updated kdeconnect on the desktop (kdeconnect-kde-1.2-20.6.x86_64) and i thought i retest the file transfers (via LAN) from the phone to the desktop.
 
Using the "Send Files" on the latest android kdeconnect (1.6.6), i sent one file (1.9MB jpeg) from my phone to the desktop and it gets as far as 1.7MB (according to Dolphin) and it shows as still transferring to the Desktop Notifications and it never seems to complete the transfer.  I can't seem to find out how to check the progress bar of the transfer on the phone.
The only way to "complete" the transfer is to stop it via the Desktop Notification and then the ".part" is removed from the file name on the desktop even though the file is not complete. 
I also tried sending 3 JPEG files and the same thing happens. The notifications on the phone then say the 3 files was sent implying it was successful, no mention of an error.

I've also have the occasion where the pairing is lost after the failed transfer. 

I've used dolphin to transfer files in seconds so there no problems with connection.
opensuse:tumbleweed:20171025
Qt: 5.9.2
KDE Frameworks: 5.38.0
KDE Plasma: 5.11.1
kwin 5.11.1
Comment 1 Aleix Pol 2017-11-03 19:38:18 UTC
Hi,
Albert Astals and I have been testing this and we haven't been able to reproduce it.

Would it be possible maybe to execute kdeconnectd on the console and see if there's any warnings that can point us to what could be going wrong?
Or any specific setup that you might be running?
Comment 2 BingMyBong 2017-11-04 11:26:55 UTC
(In reply to Aleix Pol from comment #1)
> Hi,
> Albert Astals and I have been testing this and we haven't been able to
> reproduce it.
> 
> Would it be possible maybe to execute kdeconnectd on the console and see if
> there's any warnings that can point us to what could be going wrong?
> Or any specific setup that you might be running?

I've tested again today and its working fine now.  The only thing thats different was that I forgot to charge the phone so it turned off so maybe there was something wrong with the networking on the phone.  
I'm happy for this to be closed, i should have tried rebooting the phone first, sorry.
Comment 3 Nicolas Fella 2017-11-19 23:56:09 UTC
Created attachment 108972 [details]
This file does not work
Comment 4 Nicolas Fella 2017-11-19 23:57:03 UTC
Created attachment 108973 [details]
This file does work
Comment 5 Nicolas Fella 2017-11-19 23:58:14 UTC
I was able to reproduce the issue. It does not affect all files. Small files (about less than 2MB) seem to have issues
Comment 6 Nicolas Fella 2017-11-20 00:25:49 UTC
The issue seems to be in the FileTransferJob, because it affects the notification plugin as well. Reverting https://cgit.kde.org/kdeconnect-kde.git/commit/?id=d1d84bc464c5f85268a9a1229 resolves the issue for me
Comment 7 Albert Astals Cid 2017-11-20 08:37:36 UTC
Since you're a different person can you please specify the kdeconnect and kio versions you're using
Comment 8 Nicolas Fella 2017-11-20 11:24:46 UTC
KDEConmect is build from master. KIO is 5.40.0, but I already observed the issue with 38 and 39. Distro is Manjaro (Arch). Qt is 5.9.2
Comment 9 Albert Astals Cid 2017-11-20 21:38:45 UTC
Just to make sure, are you sure it doesn't work or is that you don't get a notification? small files are sometimes so fast that you don't really get a progressbar for them but they actually get transfered just fine.
Comment 10 Nicolas Fella 2017-11-20 21:59:58 UTC
Yes, absolutely sure. 

Running the daemon on the console gives me the following output when transferring the file that fails:
kdeconnect.core: KdeConnect daemon starting
kdeconnect.core: onStart
kdeconnect.core: KdeConnect daemon started
kdeconnect.core: Broadcasting identity packet
kdeconnect.core: Starting client ssl (but I'm the server TCP socket)
kdeconnect.core: Socket succesfully stablished an SSL connection
kdeconnect.core: It is a known device "OnePlus"
kdeconnect.plugin.sftp: add to dolphin
kdeconnect.plugin.sftp: Created device: "OnePlus"
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kdeconnect.core: FileTransferJob Downloading payload to QUrl("file:///tmp/kdeconnect/96986c0da73802429364605fefc5f8c2") size: 310

A successful transfer looks like this:

kdeconnect.core: KdeConnect daemon starting
kdeconnect.core: onStart
kdeconnect.core: KdeConnect daemon started
kdeconnect.core: Broadcasting identity packet
kdeconnect.core: Starting client ssl (but I'm the server TCP socket)
kdeconnect.core: Socket succesfully stablished an SSL connection
kdeconnect.core: It is a known device "OnePlus"
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kdeconnect.plugin.sftp: add to dolphin
kdeconnect.plugin.sftp: Created device: "OnePlus"
kdeconnect.core: FileTransferJob Downloading payload to QUrl("file:///tmp/kdeconnect/75496f3319233b6ce636394d56ccae80") size: 25587
kdeconnect.core: Finished transfer QUrl("file:///tmp/kdeconnect/75496f3319233b6ce636394d56ccae80")

The file transfers were triggered from the notifications plugin which uses a FileTransferJob for the notification icons. It can be reproduced by sending files via the SharePlugin Android -> PC as well
Comment 11 Albert Astals Cid 2017-11-20 22:58:53 UTC
ok, with the 398 bytes i can reproduce the problem, i'm going on holidays this week so i won't be able to look at it at least in the next 15 days, maybe Aleix or other-Albert can have a look?
Comment 12 Albert Astals Cid 2017-12-04 23:19:50 UTC
Proposed workaround at https://phabricator.kde.org/D9190
Comment 13 Albert Astals Cid 2017-12-19 23:00:37 UTC
Git commit d9c5673c20ea4c76880b8d4e1044523c80ab1fe4 by Albert Astals Cid.
Committed on 19/12/2017 at 23:00.
Pushed by aacid into branch 'master'.

TransferJob: fix for when the readChannelFinished has already been emitted before start is called()

Summary:
This fixes a regression by the removal of the busy loop call from bcdbe62660a9ca91b0d15f3a9a06a758ec8fdcda

Test Plan:
New test passes with the new code, didn't pass before
Sending very small files with kde connect works again

Reviewers: dfaure, apol, albertvaka

Reviewed By: dfaure, apol

Subscribers: ngraham, nicolasfella, anthonyfieroni, #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D9190

M  +36   -0    autotests/jobtest.cpp
M  +1    -0    autotests/jobtest.h
M  +5    -2    src/core/job_p.h
M  +18   -1    src/core/transferjob.cpp
M  +1    -0    src/core/transferjob.h

https://commits.kde.org/kio/d9c5673c20ea4c76880b8d4e1044523c80ab1fe4