Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

Guest

Re: WinSCP 5.1.7 assembly - FileExists sometimes freezes

We have updated our service to use WinSCP 5.1.8 and hope that this will fix the issue.

If the problem occurs again we will enable WiNSCP Session and Debug log output and wait for it to happen again...

PS: we also had an issue where the WinSCP GetFileInfo function indicated a file had zero Length but after a MoveFile, it was not empty.
But again, we have no log files for this.
martin

Re: WinSCP 5.1.7 assembly - FileExists sometimes freezes

It is difficult to help you without seeing the logs. Can you set both Session.DebugLogPath and Session.SessionLogPath; and try to replicate the problem?
Ruben72

WinSCP 5.1.7 assembly - FileExists sometimes freezes

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.