EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTPserver crashing when client closed

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
Posted: 01/11/2010 05:19:47
by Marcelo Danelon (Standard support level)
Joined: 01/08/2010
Posts: 2

When using samples SFTP server and SimpleSftpclient, I notice that when I end the client closing the window, the servers crashes with a access violation error. I believe the problem is related with the way server is treating this closing, and if I'm not wrong a calling like :


in the TfrmMain.RemoveClientFromList procedure , before


should fix it. Is this OK ? Sorry if this sounds very basic, but I`m newbie in this kind of application. .
Posted: 01/11/2010 17:41:06
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Hi. Thank you for pointing us at this issue.
It's not that way - all server threads must be terminated in .Finalize method.
However, RemoveClientFromList() should also check for FFinalizing flag, i.e. should be changed to:
procedure TfrmMain.ServerThreadConnClosed(Sender: TObject);
  if not FFinalizing then

But, this approach also causes another error, which we are investigating at the moment.
Posted: 01/12/2010 11:16:46
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Hi again.
You also need to add some other changes to code:
ServerThread.pas, TSSHServerThread.Destroy:
Move lines
  if FSSHServer.Active then
to the top (just right after 'begin')

MainForm.pas, TfrmMain.Finalize:

change cycle below to:
  for I := 0 to Length(Thr) - 1 do
    Thr[I].FreeOnTerminate := false;



Topic viewed 874 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!