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

Author Message
BigB
[View user's profile]

Joined: 2017-03-27
Posts: 7
Location: New York
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.
WinSCP_Failed_SessionLog.txt (6.3 KB) [Download]

Description: WinSCP Session Log

Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26456
Location: Prague, Czechia
Thanks for your report.

We need debug log file (Session.DebugLogPath).
BigB
[View user's profile]

Joined: 2017-03-27
Posts: 7
Location: New York
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.
merch_dlr_debug_20170404_101003.log (197.79 KB) [Download]

Description: Debug Log (Level = 1)

merch_dlr_20170404_101003.log (12.9 KB) [Download]

Description: Session Log

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26456
Location: Prague, Czechia
I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.
BigB
[View user's profile]

Joined: 2017-03-27
Posts: 7
Location: New York
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.
pbs_imgoing_debug_20170412_111714.log (170.89 KB) [Download]

Description: Debug Log

pbs_imgoing_20170412_111714.log (8.58 KB) [Download]

Description: Session Log

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26456
Location: Prague, Czechia
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?
BigB
[View user's profile]

Joined: 2017-03-27
Posts: 7
Location: New York
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?
BigB
[View user's profile]

Joined: 2017-03-27
Posts: 7
Location: New York
Martin,

I set the debug level to 2. I've attached new logs for you to review.
pbs_thingstoknow_20170414_111204.log (10.71 KB) [Download]

Description: Session Log

pbs_thingstoknow_debug_20170414_111204.log (170.09 KB) [Download]

Description: Level 2 Debug Log

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26456
Location: Prague, Czechia
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?
BigB
[View user's profile]

Joined: 2017-03-27
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26456
Location: Prague, Czechia
Usually after WinSCP sends a password to the server.
BigB
[View user's profile]

Joined: 2017-03-27
Posts: 7
Location: New York
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26456
Location: Prague, Czechia
Sorry, I do not think I can help you further remotely.
Advertisements

You can post new topics in this forum






Search

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