Rest shutdown

delphi package - automated exception handling
Post Reply
tultalk
Posts: 3
Joined: Tue Mar 19, 2019 10:52 am

Rest shutdown

Post by tultalk »

My app erratically requires run|reset shutdown. No mad report

Is there some setting that will follow through on this?

Thanks
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Rest shutdown

Post by madshi »

I'm not completely sure what you're asking. Can you clarify?
tultalk
Posts: 3
Joined: Tue Mar 19, 2019 10:52 am

Re: Rest shutdown

Post by tultalk »

When I close app (in IDE) it erratically just hangs doing nothing and I have to shut it down with rest
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Rest shutdown

Post by madshi »

Does this only happen if madExcept is enabled? Or does it also happen without madExcept?

Or in other words: Do you think this is a bug in madExcept?
tultalk
Posts: 3
Joined: Tue Mar 19, 2019 10:52 am

Re: Rest shutdown

Post by tultalk »

Don't know. I have just run exe 6 times and not hanging but get mem leak report

When I run in IDE with Mad hangs erratically when I repeart same steps.
Problem: 004eee27 > call -$d32a0 ($41bb8c) ; Winapi.Windows.MsgWaitForMultipleObjects

What to do? Who knows

Code: Select all

date/time          : 2019-03-19, 15:19:39, 712ms
computer name      : WS2
user name          : tulta
registered owner   : tultal@hughes.net / HP Inc.
operating system   : Windows 8 x64 build 9200
system language    : English
system up time     : 5 days 21 hours
program up time    : 5 minutes 2 seconds
processors         : 2x AMD A9-9425 RADEON R5, 5 COMPUTE CORES 2C+3G
physical memory    : 3796/7638 MB (free/total)
free disk space    : (C:) 789.45 GB
display mode       : 1600x900, 32 bit
process id         : $21c4
allocated memory   : 153.79 MB
largest free block : 729.75 MB
executable         : IBConsole.exe
exec. date/time    : 2019-03-19 15:14
version            : 1.0.0.0
compiled with      : Delphi 10.3 Rio
madExcept version  : 5.0.0
contact name       : Robert
contact email      : tultalk@hughes.net
callstack crc      : $2fa82e95, $72f98797, $6744de50
exception number   : 1
exception message  : The application seems to be frozen.  <-----------------------------------------------------

main thread ($2d40):
76d0a00e +05e USER32.dll                               MsgWaitForMultipleObjects
004eee27 +06f IBConsole.exe System.Classes   15899 +18 TThread.WaitFor
007dea3e +076 IBConsole.exe IBX.IBSQLMonitor   778 +21 TIBSQLMonitorHook.UnregisterMonitor
007dd406 +046 IBConsole.exe IBX.IBSQLMonitor   279  +5 TIBCustomSQLMonitor.Destroy
004099ec +008 IBConsole.exe System           17466  +1 TObject.Free
004ef95a +076 IBConsole.exe System.Classes   16294 +10 TComponent.DestroyComponents
004ef3f3 +01b IBConsole.exe System.Classes   16091  +3 TComponent.Destroy
005cad43 +163 IBConsole.exe Vcl.Controls      5471 +24 TControl.Destroy
005d12ec +1c4 IBConsole.exe Vcl.Controls      8587 +45 TWinControl.Destroy
006f197e +05e IBConsole.exe Vcl.Forms         3123  +3 TScrollingWinControl.Destroy
006f309d +139 IBConsole.exe Vcl.Forms         3809 +32 TCustomForm.Destroy
004099ec +008 IBConsole.exe System           17466  +1 TObject.Free
004ef95a +076 IBConsole.exe System.Classes   16294 +10 TComponent.DestroyComponents
006f0151 +035 IBConsole.exe Vcl.Forms         2220  +9 DoneApplication
00455e95 +021 IBConsole.exe System.SysUtils   5918  +6 DoExitProc
0040b6a2 +06e IBConsole.exe System           24661 +55 @Halt0
00a66b68 +2ec IBConsole.exe IBConsole          127 +48 initialization
745b8492 +022 KERNEL32.DLL                             BaseThreadInitThunk

thread $36d8:
76d0a00e +5e USER32.dll    MsgWaitForMultipleObjects
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $1a2c:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $2fec:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $3350:
76225a0d +12d KERNELBASE.dll           WaitForMultipleObjectsEx
004b1fb1 +00d IBConsole.exe  madExcept CallThreadProcSafe
004b2016 +032 IBConsole.exe  madExcept ThreadExceptFrame
745b8492 +022 KERNEL32.DLL             BaseThreadInitThunk
>> created by main thread ($2d40) at:
74781b73 +000 combase.dll

thread $ed8 (TReaderThread):
76214693 +93 KERNELBASE.dll                            WaitForSingleObjectEx
762145ed +0d KERNELBASE.dll                            WaitForSingleObject
007df4a5 +51 IBConsole.exe  IBX.IBSQLMonitor  1024 +13 TReaderThread.BeginRead
007df6d0 +18 IBConsole.exe  IBX.IBSQLMonitor  1089  +2 TReaderThread.ReadSQLData
007df5e9 +11 IBConsole.exe  IBX.IBSQLMonitor  1071  +5 TReaderThread.Execute
004b20cb +2b IBConsole.exe  madExcept                  HookedTThreadExecute
004edf55 +49 IBConsole.exe  System.Classes   15040 +18 ThreadProc
0040b7f0 +28 IBConsole.exe  System           24940 +45 ThreadWrapper
004b1fb1 +0d IBConsole.exe  madExcept                  CallThreadProcSafe
004b2016 +32 IBConsole.exe  madExcept                  ThreadExceptFrame
745b8492 +22 KERNEL32.DLL                              BaseThreadInitThunk
>> created by main thread ($2d40) at:
004ee018 +18 IBConsole.exe  System.Classes   15095  +1 TThread.Create

thread $18e8 (TWriterThread):
76227225 +95 KERNELBASE.dll                            SleepEx
7622717a +0a KERNELBASE.dll                            Sleep
004eece1 +01 IBConsole.exe  System.Classes   15784  +0 TThread.Sleep
007ded0b +8b IBConsole.exe  IBX.IBSQLMonitor   842 +15 TWriterThread.Execute
004b20cb +2b IBConsole.exe  madExcept                  HookedTThreadExecute
004edf55 +49 IBConsole.exe  System.Classes   15040 +18 ThreadProc
0040b7f0 +28 IBConsole.exe  System           24940 +45 ThreadWrapper
004b1fb1 +0d IBConsole.exe  madExcept                  CallThreadProcSafe
004b2016 +32 IBConsole.exe  madExcept                  ThreadExceptFrame
745b8492 +22 KERNEL32.DLL                              BaseThreadInitThunk
>> created by main thread ($2d40) at:
004ee018 +18 IBConsole.exe  System.Classes   15095  +1 TThread.Create

thread $2b30:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $628:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $2e34:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $344c:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $39f4:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $2254:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

thread $2fb8:
745b8492 +22 KERNEL32.DLL  BaseThreadInitThunk

disassembling:
[...]
004eee19         push    $3e8
004eee1e         push    0
004eee20         lea     eax, [esp+$10]
004eee24         push    eax
004eee25         push    2
004eee27       > call    -$d32a0 ($41bb8c)      ; Winapi.Windows.MsgWaitForMultipleObjects
004eee27
004eee2c         mov     ebx, eax
004eee2e 15901   cmp     ebx, -1
004eee31         setnz   dl
004eee34         mov     eax, esi
[...]

error details:
Waiting
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Rest shutdown

Post by madshi »

Looking at the freeze report it seems to be your EXE which is frozen, not the IDE? Or does the IDE freeze with it?

In any case, the freeze report indicates that in the moment when your EXE shuts down, "TIBCustomSQLMonitor.Destroy" is called, which then calls "TIBSQLMonitorHook.UnregisterMonitor", which then calls "TThread.WaitFor". So it seems "TIBCustomSQLMonitor.Destroy" is waiting for a specific secondary thread to close down, which doesn't seem to happen.

I don't know why this happens, could be a bug in "TIBCustomSQLMonitor.Destroy", maybe? I don't know "TIBCustomSQLMonitor". You could try analyze the source code to see which thread it's waiting for and why that thread doesn't close down properly. See "IBX.IBSQLMonitor" lines 279 and 778.
Post Reply