Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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.
Cbeach

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)
xizwyck

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?
martin

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.
GRR3

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?
martin

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.
GRR3

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.
martin

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.
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.
martin

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?
GRR3

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.