Bug 419266 - Copying file continues for 8 seconds after canceled
Summary: Copying file continues for 8 seconds after canceled
Status: RESOLVED NOT A BUG
Alias: None
Product: krusader
Classification: Applications
Component: general (show other bugs)
Version: 2.7.2
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-26 12:56 UTC by goo
Modified: 2020-04-16 13:07 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description goo 2020-03-26 12:56:20 UTC
SUMMARY
When copying a large file and clicking "Cancel" in the file copy progress dialog  the copying process continues for approx. 8 seconds in the background.

STEPS TO REPRODUCE
1. Copy a large file which takes a few minutes
2. Click "Cancel" in the progress dialog
3. Observe that the file-size is still increasing for 8 seconds

OBSERVED RESULT
Copy process keeps copying in background after canceled

EXPECTED RESULT
Copy process stops immediately 

SOFTWARE/OS VERSIONS
Debian 10.3.0 MATE 1.20.4

ADDITIONAL INFORMATION
Comment 1 Davide Gianforte 2020-03-29 18:29:51 UTC
In Linux, file copies (really, all files) are handled through a memory buffer. When you start a copy, you should see a fast progress because it is filling the buffer and when it is filled, the real write starts.

Using a system monitor (e.g. KSysGuard, htop) you can see a memory drop when the copy ends, meaning that the buffer was freed. For the same reason, if you copy a file over a network share you also see that the traffic starts a bit after. Almost all systems, like KIO which is used by Krusader, show the percentage of data sent to the buffer and it seems that the copy stucks at 100% because the buffer size is yet to be written on disk.
Comment 2 goo 2020-03-30 07:45:02 UTC
The problem is not the delay because of filling and reading the buffer or the process stucking at 100%, but when you click "Cancel" the copying process continues for a very long time of 8 seconds. 

In other file managers I know when you click "Cancel" the copying process is stopped immediately and does not continue for such a long time.

Also when you run "cp" command line and press "Ctrl-C" the process stops immediately. This is the expected behaviour when canceling a copying proccess.

Just try it with the standard file manager of you system. When you click "Cancel" the copying process stops immediately but in the latest version of Krusader the copying process continues for up to 8 seconds as you can see the file size growing for 8 seconds after you clicked "Cancel".

On the other hand when you click "Pause" in Krusader the copying process stops immediately. So one way to solve this issue might be to implement pausing the copying process before canceling it.
Comment 3 Christoph Feck 2020-04-14 13:59:32 UTC
Could you compare with Dolphin? Both should use KIO. I am not sure if Krusader has a separate copy dialog, or if you are just clicking into the standard KIO progress notifications.
Comment 4 Christoph Feck 2020-04-14 14:00:57 UTC
The problem might also be that you aren't using Plasma, so you only get a fallback dialog, which KDE developers rarely test.
Comment 5 goo 2020-04-16 07:32:00 UTC
You were right, Dolphin also shows the same symptoms. So this is a bug in KIO?
Comment 6 Christoph Feck 2020-04-16 13:07:49 UTC
I cannot reproduce, neither with Plasma's progress dialog, nor KIO's fallback window. I tried with a file that is larger than memory to rule out caching. There is no delay when clicking Cancel. In fact, the incomplete destination file is removed the second you click on the button.

I suggest to test with recent versions of KDE and Qt software before I reassign. Debian stable is already outdated on arrival, because of the long freezing phase.