• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 848
  • Last Modified:

Strange "random" exception in a Delphi 2009 application

In one "large" (100.000 lines of code + 3rd party libs) Delphi application, I get the following Madshi stack traceS (message in french, sorry, means access violation at address ...)
What is very strange is the following : the crashes occur when "apparently" calling function gm2000Dispatch, as the trace is not inside the function gm2000Dispatch code which, by the way, in inside the same unit U2000A

exception class   : EAccessViolation
exception message : Violation d'acc¿s ¿ l'adresse 00404B95 dans le module 'Gm2000.exe'. Lecture de l'adresse FFFFFFFE.

main thread ($898):
00404b95 +00d Gm2000.exe   System    903  +0 GetDynaMethod
00404bbc +004 Gm2000.exe   System    903  +0 @CallDynaInst
004cfd3e +012 Gm2000.exe   Controls          TControl.SetVisible
004b616e +03a Gm2000.exe   Forms             TCustomForm.SetVisible
004babc3 +007 Gm2000.exe   Forms             TCustomForm.Show
0075ba0f +0c3 Gm2000.exe   U2000A   1779  +9 gm2000Dispatch
00763009 +039 Gm2000.exe   U2000A   3426  +1 TF2000A.MenuLotInformationClick
004c5fbb +0a7 Gm2000.exe   Menus             TMenuItem.Click
004c726f +013 Gm2000.exe   Menus             TMenu.DispatchCommand
004b9917 +01f Gm2000.exe   Forms             TCustomForm.WMCommand
004d1542 +2d2 Gm2000.exe   Controls          TControl.WndProc
004d5a47 +513 Gm2000.exe   Controls          TWinControl.WndProc
004b6878 +594 Gm2000.exe   Forms             TCustomForm.WndProc
004d5160 +02c Gm2000.exe   Controls          TWinControl.MainWndProc
00485e68 +014 Gm2000.exe   Classes           StdWndProc
766b8e97 +00a USER32.dll                     DispatchMessageW
004bef8d +11d Gm2000.exe   Forms             TApplication.ProcessMessage
004befd2 +00a Gm2000.exe   Forms             TApplication.HandleMessage
004bf2fd +0c9 Gm2000.exe   Forms             TApplication.Run
00768e20 +1a4 Gm2000.exe   Gm2000    285 +30 initialization
75fe1172 +010 kernel32.dll                   BaseThreadInitThunk

Sometime, I get this (in the same user action context)
exception class   : EAccessViolation
exception message : Violation d'acc¿s ¿ l'adresse 00000000. Lecture de l'adresse 00000000.

main thread ($d8):
00000000 +000 ???
00485e68 +014 GM2000.EXE Classes           StdWndProc
004cc544 +0fc GM2000.EXE Controls          InitWndProc
7c91eae0 +010 ntdll.dll                    KiUserCallbackDispatcher
77d1ff7e +02e USER32.dll                   CreateWindowExW
0040b413 +03f GM2000.EXE Windows           CreateWindowEx
004d4884 +030 GM2000.EXE Controls          TWinControl.CreateWindowHandle
004b8844 +0fc GM2000.EXE Forms             TCustomForm.CreateWindowHandle
004d47a1 +139 GM2000.EXE Controls          TWinControl.CreateWnd
004b486d +005 GM2000.EXE Forms             TScrollingWinControl.CreateWnd
004b8556 +00a GM2000.EXE Forms             TCustomForm.CreateWnd
004d4baa +016 GM2000.EXE Controls          TWinControl.CreateHandle
004d872c +01c GM2000.EXE Controls          TWinControl.HandleNeeded
004d8739 +005 GM2000.EXE Controls          TWinControl.GetHandle
004b7354 +00c GM2000.EXE Forms             TCustomForm.GetMonitor
004b7bbc +088 GM2000.EXE Forms             TCustomForm.SetWindowToMonitor
004b6165 +031 GM2000.EXE Forms             TCustomForm.SetVisible
004babc3 +007 GM2000.EXE Forms             TCustomForm.Show
0075ba0f +0c3 GM2000.EXE U2000A   1779  +9 gm2000Dispatch
00763009 +039 GM2000.EXE U2000A   3426  +1 TF2000A.MenuLotInformationClick
004c5fbb +0a7 GM2000.EXE Menus             TMenuItem.Click
004c726f +013 GM2000.EXE Menus             TMenu.DispatchCommand
004b9917 +01f GM2000.EXE Forms             TCustomForm.WMCommand
004d1542 +2d2 GM2000.EXE Controls          TControl.WndProc
004d56ca +196 GM2000.EXE Controls          TWinControl.WndProc
004b6878 +594 GM2000.EXE Forms             TCustomForm.WndProc
004d5160 +02c GM2000.EXE Controls          TWinControl.MainWndProc
00485e68 +014 GM2000.EXE Classes           StdWndProc
77d18a0b +00a USER32.dll                   DispatchMessageW
004bef8d +11d GM2000.EXE Forms             TApplication.ProcessMessage
004befd2 +00a GM2000.EXE Forms             TApplication.HandleMessage
004bf2fd +0c9 GM2000.EXE Forms             TApplication.Run
00768e20 +1a4 GM2000.EXE Gm2000    285 +30 initialization

On another trace, I get an Abstract Error (trace not currently available)

Same user action, different crash
The problems for me to fix this are :
1. is this real that a simple function call can crash before being inside the function, as it looks to be here ?
2. I can't reproduce the problem on my development PC, neither in debug mode in the IDE, nor outside, executing the .exe

How can I find what's wrong there ?
(that application has run for years and I made changes from time to time, this time there were many changes but I can't figure out what makes it fail now)
  • 6
  • 4
1 Solution
Geert GruwezOracle dbaCommented:
have you tried starting the app with F8
and then menu search / find error > 00404B95
and see what line you get  ?

in debug options checking "use debug dcus" and recompile may help to indicate the source line
LeTayAuthor Commented:
I could not locate "find error" in debug mode, search ...
Can you tell me precisely where the use debug dcu option is located ? I have a french version of Delphi
ps : in debug mode and in general in the IDE, I never had that error happening
If the error was not happening before then I would recompile as it was before.  Add in one section of new code changes at a time and let the process tell you where the error is occurring.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Geert GruwezOracle dbaCommented:
find error is the bottom option of the search menu
LeTayAuthor Commented:
Well, not on my Delphi 2009
There is no find error in the Search sub-menu, even grayed ...
There is however a goto address : is this what you mean

I am also interested in the "user debug dcu" but can't locate it
LeTayAuthor Commented:
What is worrying me is that it seems that the exception occurs on a function call and not inside that function code itself, which is probably the place where it really happens
Geert GruwezOracle dbaCommented:
use debug dcus option can be found in compiler options
if you have source code of native delphi units like 'classes.pas' then you can debug into those units too

goto address, yes, name was changed and i didn't have delphi yesterday :)
LeTayAuthor Commented:
About "use debug DCU", i suppose you mean that, if I set this option, later on at execution, it is crashes inside such unit, Madshi will report it ?
Geert GruwezOracle dbaCommented:
there will probably be more detail in the debug report for the stack trace

doesn't the goto address give you a specific line of code for the first error ?
LeTayAuthor Commented:
Goto give something but like this :  ?????
LeTayAuthor Commented:
I changed the "use debug dcus" option to ON
When I build the project, I now get an error
It says that unit TEEngine was compiled with another version (of Delphi)
This unit is part of TEEChart that I use in the application
I guess I will have to upgrade to Delphi 2009 for having the compilation completed ...

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now