Timeout waiting for WinSCP to respond

Advertisement

GRR3
Joined:
Posts:
10

Timeout waiting for WinSCP to respond

I get error "Timeout waiting for WinSCP to respond" on scripts for one vendor. It occurs intermittently, several times a week (~5 of ~70 runs fail).
I have similar scripts to other vendors that do not get this error, so I think this could be a connection issue- but I'm open to the possibility that I have a configuration issue and hoped you might see something in the logs to indicate this.

I have reviewed documentation about this error, but had a question about:
Alternatively, you can use (undocumented) property Session.XmlLogPath to change the log file location.
In my scripts, I set up locations for session and debug logs that I know the account running the script has access to. Are these logs different than the log mentioned above?
If so, would I set this (in Powershell) as:
$session.XmlLogPath = "\\location_of_log\"
Thank you.
  • 2017-Sep-04_04-30-02_CH_debug_log.txt (48.29 KB, Private file)
Description: debug log
  • 2017-Sep-04_04-30-02_CH_session_log.txt (9.3 KB, Private file)
Description: session log

Reply with quote

Advertisement

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

Re: Timeout waiting for WinSCP to respond

I do not see any "Timeout waiting for WinSCP to respond" error in the log file. Is this really a log file of the failed session? Can you post a callstack of the exception?

Reply with quote

Guest

Re: Timeout waiting for WinSCP to respond

I have the script set up to create separate log files. I have attached the log file for the script itself, which shows the exception caught.

I also create separate session and debug logs for each connection the script makes and in the previous post attached the logs for the connection that failed.

I'm not sure what the callstack is, or I would post it.
  • script_to_forum.txt (13.39 KB, Private file)
Description: script
  • 2017-Sep-04_04-30-02_script_log.txt (2.34 KB, Private file)
Description: script log

Reply with quote

martin
Site Admin
martin avatar

Re: Timeout waiting for WinSCP to respond

OK, I didn't notice, that you are not using the latest version of WinSCP.

Please upgrade and post new session and debug log files.

Reply with quote

GRR3
Joined:
Posts:
10

Re: Timeout waiting for WinSCP to respond

I have updated to the latest version. Again, this error occurs intermittently, so this is the first occurrence after updating.

Thank you.
  • 2017-Sep-14_11-30-01_WinSCP_session_log.txt (12.39 KB, Private file)
Description: session log
  • 2017-Sep-14_11-30-01_WinSCP_debug_log.txt (51.13 KB, Private file)
Description: debug log
  • 2017-Sep-14_11-30-01_my_script_log.txt (486 Bytes, Private file)
Description: script log

Reply with quote

Advertisement

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

Re: Timeout waiting for WinSCP to respond

WinSCP stops on waiting for the server to open file fil2041144889.mbx.PAH60384.75261.

I do not know if your server is ever going to respond, obviously.

Anyway, you have set SessionOptions.Timeout to 120 seconds.

But as Session.Timeout is set to its default 60 seconds, the .NET assembly will kill WinSCP after those 60 seconds, so WinSCP will never have a chance to wait 120 seconds.

If you really want WinSCP to wait 120 seconds (hoping the server ever responds), you have to set the Session.Timeout at least to 120 seconds too.

Reply with quote

GRR3
Joined:
Posts:
10

Re: Timeout waiting for WinSCP to respond

Thank you, I set Session.Timeout to 120 seconds.

I do not understand the difference between the SessionOptions.Timeout and Session.Timeout.

Would it make sense for me to set SessionOptions.Timeout to 120 seconds and Session.Timeout to a larger value?
Would I then get an error that says "Timeout waiting for the remote server" instead of "Timeout waiting for WinSCP to respond".
Or how would you expect these to be set?

Reply with quote

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

Re: Timeout waiting for WinSCP to respond

GRR3 wrote:

Would it make sense for me to set SessionOptions.Timeout to 120 seconds and Session.Timeout to a larger value?
Would I then get an error that says "Timeout waiting for the remote server" instead of "Timeout waiting for WinSCP to respond".
Yes. That's about right.

Reply with quote

xizwyck
Joined:
Posts:
1

Error still exists in latest version

I'm using the latest version, just downloaded today and I still get an error:
System.TimeoutException: Timeout waiting for WinSCP to respond - WinSCP has not responded in time. There was no output. Response log file D:\Temp\wscp0D34.01E329F8.tmp was not created. This could indicate lack of write permissions to the log folder or problems starting WinSCP itself. at WinSCP.Session.CheckForTimeout(String additional) at WinSCP.Session.Open(SessionOptions sessionOptions) at...
This is on a remote server and the application is running under an ID that is not a true admin... that being said, I have the session log path set to a particular folder that would work. I attempted to set the debug log path but then it said that the valid path was not found (?).

Also, I set the session log path to a specific folder but it appears that is being ignored. And yes, I set the path before I called Open().

Any ideas or am I wasting my time on this product?

Reply with quote

Advertisement

Cbeach
Joined:
Posts:
3

Solved it for me

This just started occurring about a month ago with us with two different sites. Read the threads and tried everything, then it finally worked.

Here is a list of changes in reverse chronological order. Don't know if the last one was the solution or a combo of changes.

In reverse order
  1. $Session.Timeout = 1000000000;
    After trying out many smaller values
  2. Ensure WinSCP objects are not hanging around.
    At start:
    if ($session) {
        try {$session.Dispose();} catch {};
    }
  3. Ensure I was not picking up an errant module:
    Set-Location -path "C:\Program Files (x86)\WinSCP\"; Add-Type -Path "WinSCPnet.dll";
  4. $SessionOptions.AddRawSettings("SendBuf", "0");
    (suggested in debug.log)
  5. Added
    [System.Net.SecurityProtocolType]::Tls12
  6. $SessionOptions.timeout=6000
  7. Installed past versions of WinSCP back to 4.x.x; Same error result
Having a debug log was helpful. However, I found it was occasionally error on
$session.DebugLogPath = xxxx
saying it was open by another process. Resolved it by ensuring unique file name
$session.DebugLogPath = "xxxxxxxxxxx\WinSCP\" +"debug_"(Get-Date).toString("yyyyMMdd_HHmmss") + ".log";
Hope this helps someone.

(Despite the frustration, WinSCP is awesome)

Reply with quote

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

Re: Solved it for me

@Cbeach: Thanks for sharing your findings. Then it was likely indeed the Session.Timeout that solved your problems. The 1000000000 is not that "small". The Session.Timeout is TimeSpan. When converting numeric literals to TimeStamp, PowerShell interprets them as "Ticks", what is "one ten-millionth of a second":
https://learn.microsoft.com/en-us/dotnet/api/system.datetime.ticks
So 1000000000 is "only" 100 seconds.

It's better to use Session.TimeoutInMilliseconds property or New-TimeSpan cmdlet.

Reply with quote

Advertisement

You can post new topics in this forum