TROSuperTCPCannel - reconnect

Hi there,
According to my own Question some time ago we’ve changed the reconnect approach from AutoReconnect to ChannelException. This is working about 99%. Unfortunately sometimes some clients on customer site do not reconnect after server service restart. We’ve tried to get deeper adding massive logging.

The EventHandling:

  FROChannel.OnConnected    := OnChannelStateChanged;
  FROChannel.OnDisconnected := OnChannelStateChanged;
  FROChannel.OnException    := OnChannelException;
  FROChannel.OnFailure      := OnChannelException;

The OnChannelException looks like this right now:

procedure TServiceCommunication.OnChannelException(Sender: TROTransportChannel; anException: Exception; var aRetry: Boolean);
begin
  aRetry:= RetryConnect;
//  if FLastConnectedState <> s_disconnected then
    TLogger.Log.Debug('channel exception. LastConnectedState: %s, Retry: %s, Host: %s, ExceptionType: %s, Exception: %s,  ',
                      [TRttiEnumerationType.getName(FLastConnectedState), BoolToStr(aRetry, True), FRoChannel.Host, anException.ClassType.ClassName, anException.Message], 'connection');
  if aRetry then
  begin
    if FLastConnectedState <> s_disconnected then
    begin
      FLastConnectedState := s_disconnected;
      FLastErrMsg:= anException.Message;
      if anException is EROUnregisteredServerException then
        TLogger.Log.Error('EROUnregisteredServerException received!',[],'connection');
      if Assigned(FOnConnectionStateChanged) then
        FOnConnectionStateChanged(self, FROChannel.Tag, FROChannel, FLastErrMsg);
    end;
  end;
end;

The OnChannelStateChanged:

procedure TServiceCommunication.OnChannelStateChanged(Sender: TObject);
begin
  TLogger.Log.Debug('OnChannelStateChanged. ConnectedState: %s, Host: %s',[BoolToStr(FROChannel.Connected,True), FRoChannel.Host],'connection');
  if FROChannel.Connected then
  begin
    FLastErrMsg:= '';
    FLastConnectedState:= s_connected;
  end
  else
  begin
    FLastConnectedState:= s_disconnected;
    TTask.Run(
      procedure
      begin
       sleep (1000);
       TThread.Synchronize(TThread.Current,
         procedure
         begin
           FROChannel.Active:= True;
         end);
      end);
  end;

  if Assigned(FOnConnectionStateChanged) then
    FOnConnectionStateChanged(self, FROChannel.Tag, FROChannel, FLastErrMsg);
end;

When the server disconnects the client will periodically log the channel exception message as expected.
In 99% when the server comes back the OnChannelStateChanged event is fired.
But sometimes when the server is back online the channel exception logging stops
but the onChanelstateChanged is never fired until client restart.

What could happen here? Obviously “somewhere” the channel did reconnect (because channel exception is not fired anymore) . But the channelstatechanged event is missing.

  • Delphi 11.3
  • RO 10.0.0.1561
  • TROSuperTcpChannel with TLS (supertcps)
    Server is .NET.

I was never able to reproduce this behaviour here. Just at customer site.
Thanks for your help

Hi,

try to change channel to other one and retest, pls.
will this error is reproduced with the same customer?

note: all Synapse client channels support OpenSSL v3 in .1581

Should i use 1581 already? Its Preview only

Hi,

don’t worry. this is usual stable but with some new features. we may promote it to stable in a week or two.

Maybe not really the right place here. But: Now i’ve updated to 1581. TROSuperTcpChannel works still with supertcps. When i switch to TROSynapseSuperTCPChannel i get the exception:

ExceptionType: ESynapseError, Exception: SSL/TLS support is not compiled!

What does it mean? libssl-3-x64.dll and libcrypto-3-x64.dll are still there. Does it need something else?

Add: I forgot to mention that Client is 64bit. If that is important somehow.

Hi,

you should add one of these units to uses section of any unit of client-side project:

  • ssl_openssl.pas
  • ssl_openssl11.pas
  • ssl_openssl3.pas

Great. Works like this. Will rollout some of those clients to customer and see what happens.
Thanks as always for your help