tomohulk / WinSCP

WinSCP PowerShell Wrapper Module
GNU General Public License v3.0
153 stars 30 forks source link

Timeout waiting for WinSCP to respond #156

Closed shaunm001 closed 11 months ago

shaunm001 commented 11 months ago

Please fill in the following fields:

Issue Description

I have a scheduled powershell script running Sync-WinSCPPath cmdlet that regularly times out. The timeout occurs with files about 8GB in size.

Example

Sync-WinSCPPath -WinSCPSession $WinSCPSession -Mode Local -LocalPath "D:\LocalPath" -RemotePath "/mnt/remotePath" -Remove

Expected Output

Expect new files to be copied to local path, old (missing) files to be deleted from local path

Actual Output

I receive an error: "Exception calling "SynchronizeDirectories" with "7" argument(s): "Timeout waiting for WinSCP to respond""

WinSCP-PowerShell Version

6.1.1.0

Environment

Windows Server 2016 x64, powershell version 5.1.17763.4840

tomohulk commented 11 months ago

How long into the copy process does it run for before throwing the exception? I have a feeling this may have to be brought to the attention of the WinSCP devs. This is just a PowerShell wrapper around the .net assembly.

shaunm001 commented 11 months ago

Looks like about 3 - 4 min after the command is run.

tomohulk commented 11 months ago

My only suggestion is to try the -TimeOut option in New-WinSCPSessionOption. If that doesn't work, we are going to have to get the WinSCP devs involved to help on that.

shaunm001 commented 11 months ago

Awesome, I'll give that try, thanks!

tomohulk commented 11 months ago

Did that work for you?

shaunm001 commented 11 months ago

I set the timeout value to 600 and am not getting timeout errors anymore, so that's good. However I do notice now that the copy job is running extremely slow; so slow that its still running when the job starts again the following evening (so runs for over 24 hours). It's struck trying to move an 8GB file. When I use the regular WinSCP windows app to move the file, it copies in a few minutes.

I know that's a completely different issue, but any thoughts on that, ha...

tomohulk commented 11 months ago

Im thinking that something you are going to have to open up on the WinSCP forum. Or it maybe an issue with your flavor of FTP Server. Good luck.

martinprikryl commented 11 months ago

@shaunm001 Haven't you enabled verbose logging while debugging the original issue? That would slow down the operation. https://winscp.net/eng/docs/faq_slow#logging

If not, collect session log files (both from code and GUI) and post them on WinSCP support forum

shaunm001 commented 11 months ago

Hey Martin, I did not have verbose logging enabled. I see how to do that in the WinSCP windows app (GUI), but not sure how to enable logging in the PowerShell script using the WinSCP module?

tomohulk commented 11 months ago

see the help doc for New-WinSCPSession https://github.com/tomohulk/WinSCP/blob/master/Help/New-WinSCPSession.md.

shaunm001 commented 11 months ago

Thanks, I gathered the logs and posted on the support forum here