2

I have a program that started to crash on shutdown. The debugger shows:

---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class $C0000005 with message 'access violation at 0x00a69099: read of address 0x70687efe'.

When I click Continue, I see the same error. When I click 'Break' the IDE will open the EMemLeaks.pas unit.
enter image description here

The program is compiled in 'Debug' mode with ALL debugging info included. Map file is set to Details.
enter image description here

Also, I only use FreeAndNil instead of Free in MY code (but not in the 3rd party libraries).

StackTrace (from Delphi IDE):
enter image description here

The crash does not appear if:
- Eureka plugin is disabled or
- Eureka plugin is enabled and the program is running outside the IDE

The crash appears somewhere after "Application.Run". This means that all my clean up code got executed. Right?

Questions:
1. Are the settings above correct? If not, what to change?
2. What does it mean when the debugger cannot put the cursor on the code that generated the problem?
3. Is this an indication that the error is outside my code?


Update (all roads lead to Eureka):

I managed to remove ALL code in my project. This is all that is left:

INTERFACE
USES
  Winapi.Windows, Vcl.Forms,  Vcl.StdCtrls, Vcl.ComCtrls, Vcl.Controls, Vcl.ExtCtrls, System.Classes,
  IdAntiFreeze, IdFTP, IdGlobal, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, Vcl.Grids;

TYPE
  TfrmDownloader = class(TForm)
    pgCrtl          : TPageControl;
    Splitter        : TSplitter;
    tabMain         : TTabSheet;
    lblTop          : TLabel;
    pnlGrid         : TPanel;
    Panel1: TPanel;
    IdFTP1: TIdFTP;
    btnUpdates: TButton;
    StringGrid1: TStringGrid;
    Panel2: TPanel;
    btnDownStart: TButton;
    RichEdit1: TRichEdit;
  private
  protected
  public
  end;

VAR
   frmDownloader: TfrmDownloader;
IMPLEMENTATION {$R *.dfm}
end.

The project still crashes.

Even more, running a procedure called GenerateCrash will generate EXACTLY the same AV as the one that I get when I shut down the program (and Eureka is active): $C0000005.

procedure GenerateCrash;   
VAR T: TObject;
begin
 EmptyDummy;
 FreeAndNil(T);
 T.ClassName;
end;

Makes you think. Right? Plus, the EurekaLog support abandoned this issue. Probably they now know about the issue and it will be fixed in some future version (which I won't be able to access). I see that in EACH release they list quite a number of serious bugs. Since their "v7.0 Hot-fix 1" release they introduced 110 features and fixed 271 bugs. Basically with each new featured introduce they also introduced almost 3 bugs! EurekaLog must be ONE OF THE THE MUST BUGGY software products ever!

Gabriel
  • 20,797
  • 27
  • 159
  • 293
  • Use MadExcept or EurekaLog to get the exact stack of the AV – RBA Aug 31 '16 at 07:13
  • @RBA- Actually the error appeared IMMEDIATELY after installing eureka (first run). But the Eureka support says it is a double freed object in my code. I think (but I am not absolutely sure), that FreeAndNil should correctly point to a double free. Right? – Gabriel Aug 31 '16 at 07:20
  • 1
    Without seeing the code is hard to tell. – RBA Aug 31 '16 at 07:26
  • And use debug dcu's... – RBA Aug 31 '16 at 07:27
  • As a hint, disable EurekaLog and run your code to see if the problem is inside your code. – RBA Aug 31 '16 at 07:32
  • @RBA - Yes. The problem appears only when EurekaLog plugin is enabled in IDE (and active in my project). But this doesn't necessarily mean the bug is in eureka. Probably the bug comes to surface as Eureka changes my code layout. – Gabriel Aug 31 '16 at 07:35
  • Looks like a heap corruption to me. These errors could rarely be detected by the examining exception source, since it usually nowhere near a real culprit. I would be starting solving this by disabling all program modules and gradually enabling them back to determine fault source. Then by the same method faulting procedure could be located. – Ari0nhh Aug 31 '16 at 07:52
  • @whosrdaddy - c0000005 is een Access Violation. It could be triggered by an external library, sure but also in Delphi. – Lieven Keersmaekers Aug 31 '16 at 07:53
  • `FreeAndNil` will prevent a certain class of double free errors. But not all. For instance, if you have two references to the same instance and free both references then that's a double free that `FreeAndNil` cannot help you with. – David Heffernan Aug 31 '16 at 08:19
  • are you sure that using FastMM togerther with EurekaLog is good idea? may be these two debugging tools has conflict with each other? can you disable FastMM? – Zam Aug 31 '16 at 08:50
  • 2
    My suggestion is to eliminate EurekaLog and use MadExcept, or any other similar tool. – RBA Aug 31 '16 at 08:54
  • @SolarWind can you download Trial version 7.5 and try it? i am stay with 7.4.0.0 for the same reason -- update terms expired. – Zam Aug 31 '16 at 10:25
  • 1
    @Zam - Not anymore. I got this message from Kevin G. McCoy support@eurekalog.com - It was supposed to be internal but it was also accidentally sent to me - "This guy is a complete idiot. He has made about 5 wild claims about EL and how bad it is - all of them are his mistakes. I am answering him now" - They haven't even read carefully the emails. They just give quick (and random) answers. So, enough with EurekaLog. – Gabriel Sep 01 '16 at 11:37
  • 1
    @Zam - Yes. Maybe not a good idea. Eureka is plagued with bugs. LOTS and LOTS of them. But in time you get used with them. One of these bugs is that the memory leak detection module turns itself on every time you restart Delphi. Until now it created no problems. I seems that they fixed the bug a year later but my license won't cover that update (updates are per 1 year, not per version so the license will not cover all updates in v7). So I am stuck with the buggy version. https://justpaste.it/yrot – Gabriel Sep 27 '16 at 18:38

1 Answers1

4

Debugger will drop you I to the source code if it has debug info available for the source code where the exception is raised. It will have that debug information for your code. But not for RTL/VCL code etc. For a double free then the exception will often occur in RTL code even though the defect is in your code.

If you enable Debug DCUs then you are more likely to have success. Doing so gives the debugger access to debug info for RTL/VCL code.

Look at the EurekaLog stack trace though. That should have all you need to explain this.

Looking at your stack trace the AV is raised in an external DLL, that implements the debug version of FastMM. You won't learn anything by looking at that code. You need to study the stack trace to solve your problem. The answer will not be found where the access violation is raised. Memory corruption errors are frequently of this nature. The error is raised far away from the defect.

Do be aware that debug FastMM sometimes does raise AV exceptions that it subsequently ignores. These can be very misleading. That could be happening for you. However I have not encountered that at shutdown so I still suspect you have a real defect.

That said, the defect could well be in EurekaLog or in how you have configured it. If you want my advice I recommend madExcept rather than EurekaLog.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • The Eureka dialog is never shown. The error is only shown in Delphi's debugger. I see the AV message dlg with two options: Break and Continue. Pressing Continue will show the same AV, pressing Break will take me to EMemLeaks.pas. – Gabriel Aug 31 '16 at 07:31
  • And what is in the Delphi stack trace window, when you have pressed Break button? – Ari0nhh Aug 31 '16 at 07:33
  • @Ari0nhh-stack trace posted. – Gabriel Aug 31 '16 at 07:37
  • My project uses a complex class built around TIdFTP. I stripped that out, entirely. Basically, my program does nothing now. It is merely a GUI that does not function anymore (because I removed that class). So, ALL the complex code is gone! But the crash is still there. It seems to be something outside my code. Probably eureka. – Gabriel Aug 31 '16 at 09:26
  • My best guess from the stack trace is that the issue is related to Eureka and perhaps how you have configured it. – David Heffernan Aug 31 '16 at 09:27
  • I have really looked into the manual (not mentioning that I totally reinstalled eureka to have it work also with default settings). All settings seems correct. No multi-threading option is active. I tried the stack trace method with 'raw' but also with the other settings. Deactivated the memory leak detection (which keeps ractivating itself after each restart)... There are also other problems with the Log generated. I am going for the trial version of madexcept now. – Gabriel Aug 31 '16 at 09:31
  • Thanks David. I will try that. I knew it is time to move away from Eureka but I had an Eureka license and that kept me stuck with them. It is time to move on indeed. – Gabriel Aug 31 '16 at 09:33