Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Yes, you are right. I was setting the timeout directly in the GUI before establishing the connection in:
Advanced > Connection > Server response timeout > 1000 seconds.

But instead, I need to set it in VerifyFileChecksum.WinSCPextension.ps1 file.
I added:
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Timeout = new-timespan -minutes 60 //added this line

With this change, my remote computer keeps verifying a 6GB file even after an hour of waiting.
There's no way the server takes this long to get the checksum on a 6GB file that I'm currently testing. (2GB files take around 30-60 seconds to complete).

Is it possible that this issue is more downstream with the remote server?

Tested on a machine that's in the same room/switch with the server.
The 6GB file that fails on the remote laptop, succeeds on this machine in about 2 minutes.
But, with the 18GB file, it fails after exactly 10 minutes (tried 3 times) with the error:
Remote side unexpectedly closed network connection

Log attached.

It does sound like the server or one of our firewalls is closing the connection. Will verify the logs and update.

Actually, the error is due to low Session.Timeout. Normally you do not need set it explicitly, as it is automatically set to SessionOptions.Timeout, if that one is higher. But you do not seem to set the SessionOptions.Timeout. You seem to call SessionOptions.AddRawSettings("timeout"...) instead. Please set the SessionOptions.Timeout.

Thanks for your continued support.
I mentioned earlier that I tried 1000 seconds as well.
The PowerShell command throws an error about 30-60 seconds after it initiates the remote verification regardless of the timeout seconds.

At 15 seconds (default) the error in the VerifyFileChecksum log AND the PowerShell window is:
**Terminated by user.**

At Timeout 60 seconds or more, there are no errors in any log, only the PowerShell window says:
"Timeout waiting for WinSCP to respond"

No error in the WinSCP log.
During this entire time no other message or pop-up is prompted.
I think I tried this test over 50 times with various files of different sizes and different folders from multiple machines.
I tried it remotely from home and also with a machine that is sitting right next to the server on the same switch.

I'm attaching fresh logs with 1000 sec timeout.

So try even more than 60 seconds. And post new logs if that does not help.

Hello Martin,

There are no errors in the log. Only the VerifyCheckSum log has an error.
The error is "Terminated by user".
If I increase the timeout to 60 seconds, the error is then "Waiting on WinSCP to respond".

I attached:
- a full session log.
- a full session log with debug option 2.
- a VerifyChecksum log when the timeout is the default 15 sec.

Re: Error: Exception calling "CalculateFileChecksum" with "2" argument(s): "Terminated by user.

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

more testing

It looks like either WinSCP or the server times out before getting the result.

I turned on the VerifyFileCheckSum which suggested to turn off "Optimize Buffer Size".
I did but the result is the same:
Note: If the problem repeats, try turning off 'Optimize connection buffer size'.

Warning: Aborting this operation will close connection!
Attempt to close connection due to fatal exception:
**Terminated by user.**

If I increase the server response time out to 1000 seconds in WinSCP connection settings, PowerShell says:
Error: Exception calling "CalculateFileChecksum" with "2" argument(s): "Timeout waiting for WinSCP to respond"

Press any key to exit...

No error in the checksum log.

additional tests

It appears that the error only occurs with large files over 1GB.
Just attempted with a small file 0.5GB and the checksum was successful.

Using the command prompt (without WinSCP) I can successfully verify the checksum of the same file that fails using WinSCP with both MD5 and SHA1 although it takes around 30 minutes to verify the checksum on a 6GB file.
CertUtil -hashfile "\\long\path\to\remote\file\" MD5

Error: Exception calling "CalculateFileChecksum" with "2" argument(s): "Terminated by user.

I'm attempting to verify the checksum of a local file versus a remote file:

Error: Exception calling "CalculateFileChecksum" with "2" argument(s): "Terminated by user.
Error calculating checksum for file '/long/path/to/remote/file/WinSCP'."

I noticed that the output shows the checksum of the local file but fails when it attempts the remote file.

Any pointers as to why this occurs?
This is on Windows 10 with latest WinSCP using the built-in Verify Checksum command.
Using SFTP.