File transferring but .NET assembly timing out waiting to hear from host

Advertisement

Guest

File transferring but .NET assembly timing out waiting to hear from host

I've using the .NET assembly in a PowerShell script to transfer a batch of files (1 - 4 of them at a time, generally) ranging in size from 10 KB to 500 KB. The script runs 3 times per day. Because of problems we were having the the transfers timing out, I turned off the 'Optimize connection buffer size', which seemed to help.

We've been having a run of interrupted transmissions for the past week. My hunch is that it's a problem with the connection on the other end. Would you look at the attached debug log and see what you think?

Thanks.

Johnny Lee
  • debug_20170906_060301.log (104.28 KB, Private file)

Reply with quote

Advertisement

jlee
Joined:
Posts:
6

Not sure why my post showed up as "Guest" as the author, since I was logged in when I wrote it. At any rate, I seem to be logged in now and hope my identity will register so I can get alerted of any responses.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: File transferring but .NET assembly timing out waiting to hear from host

We need also a session log file.
Though this kind of problems are hard to debug even just using a log file.

Reply with quote

jlee
Joined:
Posts:
6

O.K. I've turned on session logging and will upload both logs the next time we have this problem again.

Thanks.

Johnny Lee

Reply with quote

jlee
Joined:
Posts:
6

Here is a zip file with the WINSCP debug log, the session log and logging that I do within the script. I appreciate any insight you can add into why the file uploads are failing now and then.

Thanks.

Reply with quote

Advertisement

jlee
Joined:
Posts:
6

Thanks for the suggestion. I've looked at that, but the documentation is a little confusing. Under the documentation for the Session class (https://winscp.net/eng/docs/library_session) the description for the Timeout property is "Maximal interval between two consecutive outputs from WinSCP console session, before TimeoutException is thrown. The default is one minute. It’s not recommended to change the value. For session/connection timeout, see SessionOptions.Timeout." And on the page for the SessionOptions, it says this: "Server response timeout. Defaults to 15 seconds." I don't understand the difference between the two, and which default is correct if they are referring to the same thing.

Also, what is the format for specifying a value in SessionOptions.Timeout? If 15 seconds is the default and I want to increase that to 30 seconds, would I specify the value as a literal string, or a numeral? If I was to increase it to more than 1 minute, how would that be formatted? "1:30", for example?

Thanks.

Reply with quote

martin
Site Admin
martin avatar

I've pointed you to SessionOptions.Timeout, not Session.Timeout.

Also, as documented, it's of time TimeSpan, not string nor numeral.

Reply with quote

Advertisement

jlee
Joined:
Posts:
6

Thanks. That helps.

I had never used a TimeSpan in PowerShell before, but setting it up turned out to be pretty simple. Here's the code I used:

# Setup sFTPSession options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = $strTargetHostName
UserName = $strTargetUserName
Password = $strTargetPassword
SshHostKeyFingerprint = $strTargetFingerprint
Timeout = New-TimeSpan -Seconds 30 #increase from default of 15 seconds
}

The New-TimeSpan cmdlet can specify -Minutes, -Hours, etc. as well.

And it seems to have helped with the timeout issue I was having.

Much appreciated.

Reply with quote

Advertisement

You can post new topics in this forum