Topic "Host is not communicating for 15 seconds"

Author Message
rgaetan
[View user's profile]

Joined: 2014-03-25
Posts: 16
Location: Decatur, IL
I'm using VisualBasic .NET to write a patching application. WinSCP version is 5.5.2 Build 4130. Code running on Windows 7 64-bit. Code sends a command from Windows to Linux for a patching program to run on Linux and waits for job completion. Patch apply/download time may be greater than 15 seconds. If it is, code aborts due to timeout. I've tried sendbuf = 0, sendbuf = 262144, .Timeout = 2 hr value. I still get timeouts after 15 seconds of inactivity while waiting for patch or downloads to happen and my process abends. Help ... here's the code:

Dim SessionOptions As New SessionOptions ' SCP configuration options
Dim Session As Session = New Session ' Linux connection config options
Dim Timer As New TimeSpan(2, 0, 0) ' Session Timeout interval setting: 2 hr, 0 min, 0 sec

With SessionOptions ' Set up session options
.AddRawSettings("PingType", "2") ' Send execute dummy protocol cmnds
.AddRawSettings("SendBuf", "0") ' Optimize connect buffer size
.AddRawSettings("SshProt", "3") ' Preferred SSH version: SSH-2 only
.AddRawSettings("Shell", "bash") ' SCP protocol: "bash"
.GiveUpSecurityAndAcceptAnySshHostKey = True ' Accept any SSH host key
.HostName = Buf(2) ' Hostname's IP address is in var
.Password = Pwd ' Provide decrypted password
.PortNumber = 22 ' Assign SSH channel 22
.Protocol = WinSCP.Protocol.Scp ' Assign SCP protocol
.UserName = ProxyUsr ' Provide username
End With ' SessionOptions

With Session ' Execute statements
.DisableVersionCheck = False ' Don't check lib against DLL
.DebugLogPath = Path & "Debug\" & Buf(1) & ".log" ' Set session debug path
.ExecutablePath = Path1 & "WinSCP.exe" ' Set path to SCP program
.IniFilePath = Path1 & "WinSCP.ini" ' Set path to INI file
.SessionLogPath = Path & "Session\" & Buf(1) & ".log" ' Set session transaction log path
.Timeout = Timer ' Set session timeout to two hours
.Open(SessionOptions) ' Call Linux through SCP
Cmd = "./update.sh" ' Command to execute
Str = (.ExecuteCommand(Cmd).Output).Replace(Chr(10), Chr(13) & Chr(10)) ' Linux/VAX execute
OutFile.WriteLine(Str) ' Dump exec returned text to file
Console.WriteLine(Str) ' Dump exec text returned to screen
End With ' Session
Advertisements
rgaetan
[View user's profile]

Joined: 2014-03-25
Posts: 16
Location: Decatur, IL
I am now testing with rawsetting PingType = 1
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Using SessionOptions.Timeout is the right way.

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

To generate 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.
rgaetan
[View user's profile]

Joined: 2014-03-25
Posts: 16
Location: Decatur, IL
Attached is the log file
Linux.txt (50.11 KB) [Download]

Description: Here is the logfile

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
OK, as I wrote before, you need to use SessionOptions.Timeout. You are setting Session.Timeout.
rgaetan
[View user's profile]

Joined: 2014-03-25
Posts: 16
Location: Decatur, IL
Just saw that in the code ... switching and retrying. Will get back on issue with VAX after I resolve this one ... stand by
rgaetan
[View user's profile]

Joined: 2014-03-25
Posts: 16
Location: Decatur, IL
I think I see my confusion. In Session Properties, it says "Maximal interval between two consecutive outputs from WinSCP console session, before TimeoutException is thrown. The default is one minute." In SessionOptions Properties, it says "Server response timeout. Defaults to 15 seconds." I'm now using it in both Session and SessionOptions just in case.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
rgaetan wrote:
I think I see my confusion. In Session Properties, it says "Maximal interval between two consecutive outputs from WinSCP console session, before TimeoutException is thrown. The default is one minute." In SessionOptions Properties, it says "Server response timeout. Defaults to 15 seconds." I'm now using it in both Session and SessionOptions just in case.

I have updated documentation of Session.Timeout to make it clear, one should hardly ever want to set it.
https://winscp.net/eng/docs/library_session
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License