Delphi Service Application crashing after several hours - WeOnlyDo Discussion board

Delphi Service Application crashing after several hours (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Gloegg, Tuesday, August 05, 2014, 20:20 (3761 days ago)
edited by Gloegg, Tuesday, August 05, 2014, 20:32

Hi,
I'm using wodSFTP (imported as a Type Library) in a Win32 Service Application developed in Delphi XE2.

The Application connects to an SFTP Server every 15 minutes and checks for new files. If there are any, it downloads them and then deletes them from the server.
This works fine for a couple of hours, but then I get an EOLEException saying the Component was busy and got disconnected. After that the service hangs and needs to be restarted.

The wodSFTP-Component is initialized like this:

  sftp.Connect;
  sftp.LicenseKey := 'MyLicenseKey';
  sftp.Hostname := 'MyServer';
  sftp.Login := 'MyUsername';
  sftp.Port := 22;
  sftp.Password := 'MyPassword';
  sftp.Blocking := true;
  sftp.Authentication := authPassword;
  sftp.ProxyType := ProxyNone;


The code that executes every 15 minutes looks like this

try
  sftp.Connect1;
  sftp.RemotePath := '/files';
  sftp.LocalPath := 'c:\temp\download\';
  sftp.GetFiles(sftp.LocalPath, sftp.RemotePath, 1);
  RemoveFilesFromServer; // Deletes only the downloaded files
  sftp.Disconnect1;
except
  on ex: Exception do
  begin
    fLastError := Now;
    bugreport := CreateBugReport(etNormal, ex);
    AddLog(bugreport);
  end;
end;

If another error occurs (e.g. wrong authentication) the error is logged, but the service continues, which is the desired behaviour.

Why is the behaviour different after the 'Component was busy...'-error?

Best Regards,
Nils


EDIT: The Exception occurs during the sftp.GetFiles call.


Complete thread: