Solved

Strange "random" exception in a Delphi 2009 application

Posted on 2012-03-23
11
742 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 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
find error is the bottom option of the search menu
0
 

Author Comment

by:LeTay
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:LeTay
Comment Utility
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 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
Comment Utility
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 36

Accepted Solution

by:
Geert Gruwez earned 500 total points
Comment Utility
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
Comment Utility
Goto give something but like this :  ?????
0
 

Author Comment

by:LeTay
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now