Delphi 10.4

delphi package - automated exception handling

Re: Delphi 10.4

Postby madshi » Wed Jun 10, 2020 7:48 am

Please run the installer again and make sure you installed madExcept 5 and not madExcept 4. Only madExcept 5 supports BDS21.
madshi
Site Admin
 
Posts: 10274
Joined: Sun Mar 21, 2004 5:25 pm

Re: Delphi 10.4

Postby SSchaefer » Tue Jun 23, 2020 1:08 pm

We've been testing the current BETA for Delphi 10.4 and discovered an issue with 64bit builds, if we have the compiler flag "DEBUG" defined. The application crashes with an AV, during the initialization. It seems that something goes wrong during some memory allocation code that is triggered by madExcept64.dll.
I'm not sure what exactly is the trigger in general, but I have attached a callstack where you can see what causes it in our case (the creation of an image list), so that you hopefully might be able to reproduce it, using a similar callstack:

MadExcept64Crash.png
MadExcept64Crash.png (35.94 KiB) Viewed 3538 times
SSchaefer
 
Posts: 6
Joined: Thu Dec 12, 2019 4:00 pm

Re: Delphi 10.4

Postby Anse » Wed Jun 24, 2020 10:09 am

Using Delphi 10.4 and madExcept beta for BDS21. Users of Windows 10 prerelease 200612-1734 reported an issue with the 64bit build of HeidiSQL, where the application starts but just runs in the background, showing nothing but the taskbar icon. I already compiled a version without madExcept, which works fine as the user said. Not sure if that is really caused by madExcept, it may be caused by that Windows pre-release. Just wanted to let you know.
Anse
 
Posts: 6
Joined: Thu Apr 16, 2020 3:12 pm

Re: Delphi 10.4

Postby madshi » Wed Jun 24, 2020 11:15 am

SSchaefer wrote:We've been testing the current BETA for Delphi 10.4 and discovered an issue with 64bit builds, if we have the compiler flag "DEBUG" defined. The application crashes with an AV, during the initialization. It seems that something goes wrong during some memory allocation code that is triggered by madExcept64.dll.
I'm not sure what exactly is the trigger in general, but I have attached a callstack where you can see what causes it in our case (the creation of an image list), so that you hopefully might be able to reproduce it, using a similar callstack

FWIW, you seem to be using either leak reporting or "instantly crash on buffer overrun", is that intentional? If you don't use either of these features, madExcept64.dll isn't used at all.

Can you reproduce the problem with a simple test project?
madshi
Site Admin
 
Posts: 10274
Joined: Sun Mar 21, 2004 5:25 pm

Re: Delphi 10.4

Postby madshi » Wed Jun 24, 2020 11:15 am

Anse wrote:Using Delphi 10.4 and madExcept beta for BDS21. Users of Windows 10 prerelease 200612-1734 reported an issue with the 64bit build of HeidiSQL, where the application starts but just runs in the background, showing nothing but the taskbar icon. I already compiled a version without madExcept, which works fine as the user said. Not sure if that is really caused by madExcept, it may be caused by that Windows pre-release. Just wanted to let you know.

Strange stuff. I don't suppose you can reproduce this at all on your dev PC?
madshi
Site Admin
 
Posts: 10274
Joined: Sun Mar 21, 2004 5:25 pm

Re: Delphi 10.4

Postby Anse » Wed Jun 24, 2020 11:48 am

madshi wrote:Strange stuff. I don't suppose you can reproduce this at all on your dev PC?


No, for me that works in either 32 and 64 bit, without problems. Also, I have no feedback from users with a regular Windows version reporting such an issue.

In the meantime the forum guy mentioned that two other applications show the same issue on his Windows pre-release. Assuming these two don't use madExcept, this makes it more likely to be a Windows issue, not with madExcept.
Anse
 
Posts: 6
Joined: Thu Apr 16, 2020 3:12 pm

Re: Delphi 10.4

Postby 2BrightSparks » Thu Jun 25, 2020 3:27 am

Hi, we can reproduce the issue where a 64-bit version of our software with madExcept will not start. I removed madExcept from the 64-bit version and it now works. This is with Delphi 10.3.3 and Windows 10 Pro x64 Build 20150 pre-release. We have old unsupported versions of our software that has the same issue (compiled with older versions of madExcept and Delphi) which we cannot release a fix for, so I just hope it's something Microsoft fix.
2BrightSparks
 
Posts: 28
Joined: Mon Jan 03, 2005 3:03 pm

Re: Delphi 10.4

Postby DanielT » Fri Jun 26, 2020 9:24 am

FWIW, you seem to be using either leak reporting or "instantly crash on buffer overrun", is that intentional? If you don't use either of these features, madExcept64.dll isn't used at all.

Can you reproduce the problem with a simple test project?

It took us a little to figure this one out, but the attached project should show the behavior ..

Main steps:
- Disable the 'report resource leaks' option in the MadExcept settings
- Call StartLeakChecking(False) (we do so during the initialization of a shared unit to keep consistency within all projects)
- Create a DataModule
Attachments
LeakCheck_AV.zip
(53.56 KiB) Downloaded 153 times
DanielT
 
Posts: 9
Joined: Wed May 17, 2017 8:39 am

Re: Delphi 10.4

Postby madshi » Fri Jun 26, 2020 9:33 am

Does it make sense to call StartLeakChecking if leak reporting is disabled? I'd suggest you modify the code like this:

Code: Select all
{$ifdef LeakChecking}
  StartLeakChecking(False);
{$endif}

This conditional define is automatically set/removed by madExcept when you activate/deactivate the "report resource leaks" option in the madExcept settings.
madshi
Site Admin
 
Posts: 10274
Joined: Sun Mar 21, 2004 5:25 pm

Re: Delphi 10.4

Postby DanielT » Fri Jun 26, 2020 9:46 am

We usually activate the leak reporting for debug builds only, This allows us to test the application internally and publish a version without the check (as it is faster without the check and it would irritate most of the users more, than we would benefit from it). As the .mes file is the same for both build targets, we would have to rely on {$ifdef debug} and keep it disabled by default.
DanielT
 
Posts: 9
Joined: Wed May 17, 2017 8:39 am

Re: Delphi 10.4

Postby DanielT » Wed Jul 01, 2020 11:07 am

Hello @madshi! Do you have any update on this already? I wouldn't want to push it, but some of our projects are currently failing (as they already started to migrate to Delphi 10.4, not knowing about this issue), and we would have plan whether to wait on a fix or to revert back to Delphi 10.3. Thank you!
DanielT
 
Posts: 9
Joined: Wed May 17, 2017 8:39 am

Re: Delphi 10.4

Postby DanielT » Tue Jul 07, 2020 8:41 am

Hi again! May I ask for an update on this again? Thank you!
DanielT
 
Posts: 9
Joined: Wed May 17, 2017 8:39 am

Re: Delphi 10.4

Postby Anse » Tue Jul 07, 2020 8:54 am

For users with a Windows pre-release or insider build: Windows 10 Insider Build 20161 now seems to have no issue with the madExcept 64 bit any longer.
A user of HeidiSQL just reported so: https://www.heidisql.com/forum.php?t=36542#p36546
Anse
 
Posts: 6
Joined: Thu Apr 16, 2020 3:12 pm

Re: Delphi 10.4

Postby madshi » Wed Jul 08, 2020 10:27 am

@Anse, that's great news, thanks for letting me know!

@DanielT, I just tried your test project with Delphi XE8 and it crashes, as well. So it's not specific to 10.4 at all, from what I can see.

Generally, activating leak checking at runtime, while having leak checking disabled in the madExcept settings dialog is not a good idea because leak checking requires replacing the memory manager, and if you do that "late" that means you have allocations done by the old memory manager and allocations done by the new memory manager and then if the code tries to reallocate something, which memory manager is responsible then? If you ask the wrong memory manager to reallocate, it will create an exception because it doesn't know the allocation. And that is exactly what appears to be happening in this situation.

If you want to use leak checking, it's recommended (maybe even mandatory) to enable leak checking in the madExcept settings when you compile your EXE. You can then disable/reenable leak checking at will. But telling madExcept at first to not do leak checking and then trying to disable it at runtime later is problematic due to the memory manager issue described above.
madshi
Site Admin
 
Posts: 10274
Joined: Sun Mar 21, 2004 5:25 pm

Re: Delphi 10.4

Postby DanielT » Wed Jul 08, 2020 2:32 pm

@Madshi: You are right, this issue is not specific for Delphi 10.4, but for MadCollection 2.8.8.99, which is required for Delphi 10.4.

We are using this exact code with Delphi 10.3 and MadCollection 2.8.8.0 for years already, without a problem and (as far as I see) in accordance with the documentation (http://help.madshi.net/madExceptUnit.htm)
Leak checking is normally turned on/off globally in the madExcept settings dialog. However, you can also activate it manually, even for specific threads, only, if you prefer it that way. Furthermore you can also explicitly tell madExcept to not report a specific handle or pointer as a leak. Doing so makes sense if you have an "intentional" leak somewhere or madExcept gets confused about a specific handle or pointer for some strange reason.

// You can start/stop leak checking at runtime.


Which other way would you recommend to enable leak checking for specific build targets only?
DanielT
 
Posts: 9
Joined: Wed May 17, 2017 8:39 am

PreviousNext

Return to madExcept

Who is online

Users browsing this forum: No registered users and 15 guests

cron