Jump to content

Error Code: 1400


likemike
 Share

Recommended Posts

Hello!

I often (3x / day) I get an error message "Invalid window handle Code: 1400". 

Log:

MyApp.exe: 00001C10: 10:21:54 [83.43.248.14]:EOSError : System error.  Code: 1400.
Invalid window handle : Addr: $00432FE4

Only way to solve this is restart the service.

Can anyone give me a hint, where do I have to search for in my code? What could be the reason for that?

Thanks in advance

Mike

Link to comment
Share on other sites

  • 3 months later...

This helped me a long time ago:-

ServerModule
    procedure UniGUIServerModuleException(Sender: TUniGUIMainModule; AException: Exception; var Handled: Boolean);

...

procedure TUniServerModule.UniGUIServerModuleException(Sender: TUniGUIMainModule; AException: Exception; var Handled: Boolean);
var
  s, Msg: String;
  p1, p2, p3: Integer;
begin
  DateTimeToString(formattedDateTime, 'dd/mm/yyyy hh:nn:ss.z', Now());
  try
    if Assigned(Sender) then begin
      try
        (sender as TUniMainModule).LogException(AException);
      except
        s:= 'debug';
      end;
      Handled:= True;
    end else begin
      if AException <> nil then begin
        Msg:= AException.Message;
        p1:= Pos('Invalid URI:', Msg);
        p2:= Pos('EIdOSSLAcceptError :', Msg);
        p3:= Pos('Session not found:', Msg); 
        if (p1+p2+p3) > 0 then begin
          Handled:= True;
        end else begin
          Logger.AddLog('ANDY-S', formattedDateTime+', UnAssigned MainModule "'+Msg+'"');
          Handled:= True;
        end;
      end else begin
        if IgnoreAccessViolation = True then begin
          Handled:= True;
        end;
      end;
    end;
  except
  end;
end;
 

MainModule
  public 
    //
    procedure LogException(E: Exception);
  end;

...

// Called By ServerModule
procedure TUniMainModule.LogException(E: Exception);
var
  Cmp: TComponent;
  s, s0, s1, s2, Msg, formattedDateTime: String;
begin
  s:= 'http';
  if SecureFlag = True then begin
    s:= 'HTTPS';
  end;
  DateTimeToString(formattedDateTime, 'dd/mm/yyyy hh:nn:ss.z', Now());
  s0:= ''; //formattedDateTime;
  if UserName <> '' then begin
    s0:= UserName + ' ' + formattedDateTime;
  end;
  try
    if E <> nil then begin
      Msg:= E.Message;
      Cmp:= TUniGUIApplication(UniApplication).UniSession.CurrentComponent;
      if Assigned(Cmp) then begin
        s1:= Cmp.Name + ' (' + Cmp.ClassName + ')';
        // Owner ? uniGUIBaseClasses, uniGUIClasses, uniGUIRegClasses
        if Cmp is TUniControl then s2:= TUniControl(Cmp).OwnerForm.Name
        else if Cmp is TUniComponent then s2:= TUniComponent(Cmp).OwnerForm.Name
        else s2:= '';
        uniServerModule.Logger.AddLog('ANDY-M', 'EXCEPTION - ' +
                                      s +
                                      ', IP: ' + UniSession.RemoteIP +
                                      ', SessionID: ' + UniSession.SessionID +
                                      ', UserName: ' + UserName +
                                      ', Component: ' + s1 +
                                      ', Msg: "' + Msg + '"');
      end else begin
        if uniServerModule.IgnoreAccessViolation = True then begin
          uniServerModule.Logger.AddLog('ANDY-M', 'EXCEPTION - ' +
                                        s +
                                        ', IP: ' + UniSession.RemoteIP +
                                        ', SessionID: ' + UniSession.SessionID +
                                        ', UserName: ' + UserName +
                                        ', Msg: "' + Msg + '"');
        end;
      end; // Assigned
    end else begin // nil
      if uniServerModule.IgnoreAccessViolation = True then begin
        uniServerModule.Logger.AddLog('ANDY-M', 'EXCEPTION - ' +
                                      s +
                                      ', IP: ' + UniSession.RemoteIP +
                                      ', SessionID: ' + UniSession.SessionID +
                                      ', UserName: ' + UserName +
                                      ', Msg: "UnKnown Error"');
      end;
    end; // nil
  except
  end;
end;
 

Link to comment
Share on other sites

Hello!

I've found the problem after 30 hours of testing.

The error 1400 occurs because of a memory leak.

I forgot to free one object in OnCalcFields event of a FDQuery. So the consumption of memory aumented fast.

Link to comment
Share on other sites

 Share

×
×
  • Create New...