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

HappyCamper
Joined:
Posts:
10
Location:
USA

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:
D:\WinSCP Test.zip
28-71-0B-E3-E7-FC-7B-74-4D-02-B2-C5-F1-A7-59-4C-C8-20-93-99
Error: Exception calling "CalculateFileChecksum" with "2" argument(s): "Terminated by user.
Error calculating checksum for file '/long/path/to/remote/file/WinSCP Test.zip'."
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.
Last edited by HappyCamper on 2020-12-04 05:08; edited 3 times in total

HappyCamper
Joined:
Posts:
10
Location:
USA

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\winscp-test.zip" MD5
Last edited by HappyCamper on 2020-12-08 23:03; edited 1 time in total

HappyCamper
Joined:
Posts:
10
Location:
USA

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.
• VerifyFileChecksum-TimeoutSetto1000.log (8.06 KB, Private file)
• VerifyFileChecksum-OptimizeBuffersize-Turned-Off.log (9.01 KB, Private file)

martin
Joined:
Posts:
37,893
Location:
Prague, Czechia

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

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.

HappyCamper
Joined:
Posts:
10
Location:
USA
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.
• VerifyFileChecksum.log (9.09 KB, Private file)
• winscplog debug2.log (37.56 KB, Private file)
• winscp.log (7.89 KB, Private file)

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

HappyCamper
Joined:
Posts:
10
Location:
USA
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.
• VerifyFileChecksum12-11-timeout1000.log (8.13 KB, Private file)
• WinSCP_log-12-11-debug2.log (77.27 KB, Private file)

martin
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.

HappyCamper
Joined:
Posts:
10
Location:
USA
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.
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions$sessionOptions.ParseUrl($sessionUrl)$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?

Update:
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.
• VerifyFileChecksum12-15.log (8.42 KB, Private file)

You can post new topics in this forum