likemike Posted October 14, 2021 Share Posted October 14, 2021 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 More sharing options...
Tokay Posted October 14, 2021 Share Posted October 14, 2021 May be the Eurekalog could help you find where exception occured. Link to comment Share on other sites More sharing options...
likemike Posted January 18, 2022 Author Share Posted January 18, 2022 Hello! I've tried Eureka, but there is no log when the error occurs. Is there a special option I have to activate when debugging services? Regards Mike Link to comment Share on other sites More sharing options...
andyhill Posted January 19, 2022 Share Posted January 19, 2022 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 More sharing options...
likemike Posted January 20, 2022 Author Share Posted January 20, 2022 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 More sharing options...
Recommended Posts