.NET intermittently getting "Timeout waiting for WinSCP to respond"

Advertisement

BigB
Joined:
Posts:
7
Location:
New York

.NET intermittently getting "Timeout waiting for WinSCP to respond"

We have a .NET console application that is using WinSCP version 5.9.3 to SFTP files. We have this code in various .NET EXEs that we have scheduled to run every 30 minutes to transfer different files. During a single day, we may have 30 jobs run to transfer up to 60 files in total. Normally, the jobs don't have any issues and the files are transferred successfully. However, every so often, 1 or 2 of these jobs fail for the "Timeout waiting for WinSCP to respond" message. Sometimes, 3 or 4 of the jobs fail in a given day or it could run fine for an an entire week. Any suggestions on how to resolve these timeout errors?


The .Net code is listed below. IT basically reads some settings from a configuration file and then does the WinSCP logic to put the file on the SFTP.

[code]string HostName = ConfigObject.GetValueForSectionKey(sectionGroup + "/" + sectionName, "HostName");
int PortNumber = Int32.Parse(ConfigObject.GetValueForSectionKey(sectionGroup + "/" + sectionName, "PortNumber"));
string UserName = ConfigObject.GetValueForSectionKey(sectionGroup + "/" + sectionName, "UserName");
string Password = ConfigObject.GetValueForSectionKey(sectionGroup + "/" + sectionName, "Password");
string sshHostKeyFingerprint = ConfigObject.GetValueForSectionKey(sectionGroup + "/" + sectionName, "SshHostKeyFingerprint");
string HostPath = ConfigObject.GetValueForSectionKey(sectionGroup + "/" + sectionName, "HostPath");
string sftp_TransferMode = ConfigObject.GetValueForSectionKey(sectionGroup + "/" + sectionName, "SFTP_TransferMode");

SessionOptions SFTP_SessionOptions = new SessionOptions();
SFTP_SessionOptions = SetupSFTP_SessionOptions(HostName, PortNumber, UserName, Password, sshHostKeyFingerprint);

using (Session session = new Session())
{
//Connect
session.SessionLogPath = WinSCPSessionLogPath + Path.GetFileNameWithoutExtension(WinSCPSessionLogFileName) + "_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + Path.GetExtension(WinSCPSessionLogFileName);
session.DisableVersionCheck = true;
session.Open(SFTP_SessionOptions);

TransferOptions transferOptions = new TransferOptions();
transferOptions.ResumeSupport.State = TransferResumeSupportState.Off;

switch (sftp_TransferMode)
{
case "Ascii":
transferOptions.TransferMode = TransferMode.Ascii;
break;

case "Automatic":
transferOptions.TransferMode = TransferMode.Automatic;
break;

case "Binary":
transferOptions.TransferMode = TransferMode.Binary;
break;

default:
transferOptions.TransferMode = TransferMode.Automatic;
break;
}

//Upload the file
session.PutFiles(fullfilename, HostPath, false, transferOptions).Check();
}[/code]


In case you need the config settings, I've listed them below:

[code]<!-- ************************************************************* -->
<!-- FTP Settings -->
<!-- ************************************************************* -->

<add key="HostName" value="ftp.xxxxxx.com"/>
<add key="PortNumber" value="22"/>
<add key="UserName" value="xxxxxxxx"/>
<add key="Password" value="xxxxxxxx"/>
<add key="SshHostKeyFingerprint" value="ssh-dss 1024 9c:70:28:cf:c6:dc:d1:cf:08:d2:be:42:80:18:ec:c7"/>
<add key="HostPath" value="/Triggered_Automations/PBS/01_ImGoing/Stage/"/>
<add key="SFTP_TransferMode" value="Binary"/>

<!-- ************************************************************* -->
<!-- WinSCP Settings -->
<!-- ************************************************************* -->

<add key="WinSCPSessionLogPath" value="\\MyServer\Apps\EM_ET\WinSCP_Logs\"/>
<add key="WinSCPSessionLogFileName" value="winscp_session.log"/>
<add key="UseDefault_WinSCPServerResponseTimeout" value="false"/>
<add key="WinSCPServerResponseTimeout" value="300"/>[/code]



I've attached the Session Log file as well. Please let me know if you need any additional information and I appreciate any help.
Description: WinSCP Session Log

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: .NET intermittently getting "Timeout waiting for WinSCP to respond"

Thanks for your report.

We need debug log file (Session.DebugLogPath).

Reply with quote

BigB
Joined:
Posts:
7
Location:
New York

Added the Session Debug Log

Martin,

We added the Debug Log and had to wait for one of the jobs to fail. I've attached a new Session Log and Debug Log (set the debug level = 1). Please let us know if you can identify the issue or have any suggestions. Sometimes we can go the entire day without any issues, while other times we have multiple jobs fail, all with this same message. Please advise.
Description: Debug Log (Level = 1)
Description: Session Log

Reply with quote

martin
Site Admin
martin avatar

Re: Added the Session Debug Log

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Reply with quote

BigB
Joined:
Posts:
7
Location:
New York

Revised our code to use the provided development version of WinSCP

We revised our .Net code to use this new development version of WinSCP. We didn't have any problems for a couple of days but just had a failure a short while ago. See attached logs for the session and debug logs. Still getting the message "Timeout waiting for WinSCP to respond". Please advise on the next steps to take.
Description: Debug Log
Description: Session Log

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Revised our code to use the provided development version of WinSCP

Thanks. It looks like the communication with the server really stalls.

Can you try to set the Session.DebugLogLevel to 2 and post new logs?

Reply with quote

BigB

Is Level 2 Supported for Debug Log?

I can try to change to Level 2 but when we tried that last week to set the debug logging to Level 2, we got the following error "Specified argument was out of the range of valid values. Parameter name: Logging level has to be in range 0-1" so we only could set it to 1. Will the development version of WinSCP that you provided support level 2?

Reply with quote

martin
Site Admin
martin avatar

Re: Debug Level 2 Logs

The communication between WinSCP and the server indeed stalls.
Is there anything useful in the server-side logs regarding this issue? (if you have an access to them)
Are you using the latest version of GlobalSCAPE server?

Reply with quote

Advertisement

BigB
Joined:
Posts:
7
Location:
New York

Martin,

Are you asking about the server where our .net code runs or the FTP server? I don't have access to the logs on the FTP server. I have no idea if they are using the latest version of GlobalSCAPE. I'll open a ticket with them to check things on their side since it seems that the communication stalls. Can you tell what step the communication is stalling?

Reply with quote

BigB

Martin,

ExactTarget says they don't see any issues on their side. They did not find anything in their logs. What do you suggest as the next step?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: Did you ever resolve this?

mattjharper@gmail.com wrote:

I'm experiencing similar issues. Did you ever resolve this issue? Thanks.
It's unlikely you have the same problem.
Please start a new thread and attach full session and debug log files.

Reply with quote

Advertisement

You can post new topics in this forum