Hi, I've developed a windows service in c# that starts separate upload and download threads that use the WinSCP dotNet assembly to connect to a remote host using SFTP.
v5.1.7 is the only version I've used.
The service is running on Windows Server 2008 R2.
Protocol used is SFTP.
The threads have separate instances of WinSCP.Session
The upload thread has completely frozen several times when doing a FileExists or PutFiles.
The first freeze could've been FileExists or PutFiles, I'm not sure as I only know that my UploadFile function got stuck and it calls FileExists before PutFiles.
I'm certain the FileExists has frozen because I have some traces from my log file that show an exception was raised when the WinSCP process was manually killed from the task manager after we tried to stop the service (see below).
When an SFTP operation freezes, the other thread continues to work correctly.
The only way to recover is to manually kill the WinSCP process and re-start the windows service.
Some traces (slightly edited):
2013-12-10 16:47:08 OnStop - FTP Service - Upload
2013-12-10 16:51:15 Exception was raised in UploadFile. Errors occurred when uploading ...
System.TimeoutException: Timeout waiting for WinSCP to respond
at WinSCP.Session.CheckForTimeout(String additional)
at WinSCP.SessionLogReader.DoRead()
at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.ReadToEnd(LogReadFlags flags)
at WinSCP.Session.DoGetFileInfo(String path)
at WinSCP.Session.FileExists(String path)
at ...UploadFile(String fromFolder, String toFolder, String fileName, String toFileName)
Download has also frozen when moving a remote file although this could be FileExists as well because all I know is that it hung in my MoveRemoteFile function which calls FileExists before MoveFile.
The ReconnectTime was first set to 0 as I wanted to prevent automatic retries and thought this would do so..?
Timeout is 1 hour.
After first upload freeze, I changed ReconnectTime to 30 seconds but this seems to have had no effect.
I'm thinking of changing my code to call all WinSCP.Session functions asynchronously and imposing my own timeouts but would rather not.
Is there some config setting I can change to prevent these freezes?
Note that I have no WinSCP log files as this was disabled when the freezes ocurred.