Solved

Strange "random" exception in a Delphi 2009 application

Posted on 2012-03-23
11
771 Views
Last Modified: 2012-04-01
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)
0
Comment
Question by:LeTay
  • 6
  • 4
11 Comments
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 37760218
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
0
 

Author Comment

by:LeTay
ID: 37761052
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
Thanks
ps : in debug mode and in general in the IDE, I never had that error happening
0
 
LVL 21

Expert Comment

by:developmentguru
ID: 37761301
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.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 37761471
find error is the bottom option of the search menu
0
 

Author Comment

by:LeTay
ID: 37762336
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
0
 

Author Comment

by:LeTay
ID: 37762339
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
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 37764525
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 :)
0
 

Author Comment

by:LeTay
ID: 37764709
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 ?
0
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 37764855
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 ?
0
 

Author Comment

by:LeTay
ID: 37764868
Goto give something but like this :  ?????
0
 

Author Comment

by:LeTay
ID: 37770880
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 ...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question