Background copy hangs using F2 or send to background

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
RonH
Junior Member
Junior Member
Posts: 31
Joined: 2003-03-11, 01:00 UTC

Background copy hangs using F2 or send to background

Post by *RonH »

I've noticed that during large or long copy operations, the process will hang. All I have to do to resume is focus on the background progress dialog.

Tonight, copying several 10Gb files, it's happening after each file. Used F2 this time.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This can be caused by the Windows disk cache in some cases - the file is written to the cache, and only flushed to disk when the file is closed. This can hang CloseFile for a considerable amount of time. Just be patient.
Author of Total Commander
https://www.ghisler.com
RonH
Junior Member
Junior Member
Posts: 31
Joined: 2003-03-11, 01:00 UTC

Post by *RonH »

The problem does not occur if I'm copying in the foreground.

I can see disk throughput in real-time. When in the background, it will hang at the end long after physical disk writes are complete. The instant I focus on the background dialog, the copy resumes with the next file.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

In the foreground, the copy thread and user interface thread are different. In the background, the background transfer window belongs to the copy thread so they are separate from the main TC window.
Author of Total Commander
https://www.ghisler.com
RonH
Junior Member
Junior Member
Posts: 31
Joined: 2003-03-11, 01:00 UTC

Post by *RonH »

So why would it only hang when copying in the background? Again, hang in the sense that the instant I focus on the background window, it resumes. Also, it only hangs at the end of a copy, never during.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Because in the background when the copy thread hangs, it's the same as the user interface thread of the dialog. In the foreground, the copy thread is a different thread than the user interface thread. I would have to use two threads for background transfer and background user interface to prevent that, but it could cause other problems...
Author of Total Commander
https://www.ghisler.com
RonH
Junior Member
Junior Member
Posts: 31
Joined: 2003-03-11, 01:00 UTC

Post by *RonH »

Well, I think there's something else going on. I see disk I/O in real time and can see the cache at work as free memory rises towards the end of the copy. Long after physical I/O has ceased, if I focus on the progress dialog, the next copy will begin. It's almost like the UI is hung. Somewhat odd that focus alone resumes the copy.

I've noticed this for a while but just dealt with it and didn't pursue it further. Back then it would happen even when copying many not so large files. Need to test on another system. Could be some quirky problem just on the desktop.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, as I said, the CloseFile function can hang for a considerable amount of time in some situations. There is nothing I can do to prevent that, sorry.
Author of Total Commander
https://www.ghisler.com
RonH
Junior Member
Junior Member
Posts: 31
Joined: 2003-03-11, 01:00 UTC

Post by *RonH »

If CloseFile is hanging, I'm still confused why clicking on the progress dialog will instantly un-hang it. If it does hang for a considerable amount of time occasionally, it seems unlikely that I could instantly un-hang it by focusing on the progress dialog.

It's almost like the progress dialog has not recognized that the copy is complete. Perhaps CloseFile does hang for a short bit of time as the cache is flushed in my case, but the UI seems to quit polling for status while in the background. But then you're saying while in the background the UI and copy are in the same thread. So I can see why you might think CopyFile is hung. To me it seems like the UI is hung because I can un-hang it every time by focusing.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

If CloseFile is hanging, I'm still confused why clicking on the progress dialog will instantly un-hang it.
I cannot reproduce that.
Author of Total Commander
https://www.ghisler.com
Post Reply