It is showing an Error where it does not exist.

delphi package - automated exception handling

It is showing an Error where it does not exist.

Postby luciano_f » Sat Feb 03, 2018 11:09 pm

I can not simulate this to send you because my project is very big.
The strange thing is that the error only happens with MadExcept
if I disable MadExcept the error does not happen.
if I activate EurekaLog the error does not happen either.

Is this a problem in this version I'm testing from madExcept ?

See this video attached.
where I test with the active madExcept gives the KeyViolation error if I disable the MadExcept error does not happen.

I did not show it on the Video, but EurekaLog does not show any errors.

https://mega.nz/#!02wRFBRA!ftRY9MDvoQWzvr8FVUierX7iq22aJS5Nq_vFAX4OK1Q
luciano_f
 
Posts: 23
Joined: Thu Feb 01, 2018 5:11 pm

Re: It is showing an Error where it does not exist.

Postby madshi » Sun Feb 04, 2018 8:55 am

That's clearly a bug in your program. Enabling madExcept may change timing a bit which can make some bugs visible which weren't visible before.

What you can see is that the crash is not in the main thread, but in a secondary thread ("TThread_SalvaGrid"). The crash occurs because your main thread is already in the process of shutting down the process, which includes destroying/finalizating a lot of things including the memory manager (!). But there's still the "TThread_SalvaGrid" thread running at the same time, while your main thread is destroying stuff behind your secondary thread's back!

Your program should wait for all secondary threads to be completed before shutting down. Or alternatively put the secondary threads to sleep. If any of those threads e.g. try to access the memory manager after your main thread has already finalized the memory manager, there will be a crash.
madshi
Site Admin
 
Posts: 9719
Joined: Sun Mar 21, 2004 5:25 pm

Re: It is showing an Error where it does not exist.

Postby luciano_f » Sun Feb 04, 2018 11:31 am

What I do not understand is because this only occurs with madExcept

If I do not have any error manager anything happens Delphi does not show me any errors.

  Delphi shows no errors.
  JCLDebug shows no errors.
  EurekaLog shows no errors.

  Are there any settings in madExcept for not being so intrusive?
luciano_f
 
Posts: 23
Joined: Thu Feb 01, 2018 5:11 pm

Re: It is showing an Error where it does not exist.

Postby madshi » Sun Feb 04, 2018 11:37 am

Most devs are very happy that madExcept shows them all errors without hiding anything. Do you really want madExcept to not show you some crashes/errors?

If you insist you can do this in your project's finalization (add this to a unit which gets initialized late = finalized early):

Code: Select all
procedure HideAllFinalizationExceptions(const exceptIntf: IMEException; var handled: boolean);
begin
  handled := true;
end;

finalization
  RegisterExceptionHandler(HideAllFinalizationExceptions, epQuickFiltering, stDontSync);
end.

But in case you didn't understand me clearly earlier: Your program has a bug! It is bad programming practise to have secondary threads still actively running while your main thread is in the process of finalizing/destroying all resources. If you didn't get shutdown crashes before, you've just been lucky, because the way your program currently works, you have to expect that shutdown crashes may occur randomly!!
madshi
Site Admin
 
Posts: 9719
Joined: Sun Mar 21, 2004 5:25 pm

Re: It is showing an Error where it does not exist.

Postby luciano_f » Sun Feb 04, 2018 12:22 pm

This code does not work gives the following error.

There is no overloaded version of 'RegisterExceptionHandler' That can be called with These arguments
In
RegisterExceptionHandler(HideAllFinalizationExceptions, epQuickFiltering, stDontSync);


Well now I was thinking about the fact that you say it is a mistake of my problem I will try to create a separate project to send you to me this thread that is Correct.
luciano_f
 
Posts: 23
Joined: Thu Feb 01, 2018 5:11 pm

Re: It is showing an Error where it does not exist.

Postby madshi » Sun Feb 04, 2018 12:25 pm

Swap epQuickFiltering and stDontSync, then it should compile.

Think about it: If your main thread finalizes the memory manager, any call to GetMem or FreeMem will crash. If at this moment one of your secondary threads are still running, and if they call GetMem or FreeMem, they will crash. So as a result it is very clear that once the main thread has started finalization, no secondary thread which accesses any Delphi RTL or VCL resources should still be actively running. Makes sense?
madshi
Site Admin
 
Posts: 9719
Joined: Sun Mar 21, 2004 5:25 pm

Re: It is showing an Error where it does not exist.

Postby luciano_f » Sun Feb 04, 2018 12:34 pm

If I understand correctly, you told me to change ?
"Swap epQuickFiltering and stDontSync, then it should compile."

but to exchange for what?

could put the new command.

Thankful.
luciano_f
 
Posts: 23
Joined: Thu Feb 01, 2018 5:11 pm

Re: It is showing an Error where it does not exist.

Postby madshi » Sun Feb 04, 2018 12:49 pm

Just swap the order. Instead of "epQuickFiltering, stDontSync" use "stDontSync, epQuickFiltering".
madshi
Site Admin
 
Posts: 9719
Joined: Sun Mar 21, 2004 5:25 pm

Re: It is showing an Error where it does not exist.

Postby luciano_f » Sun Feb 04, 2018 6:52 pm

Young really you were correct.

My system had a Bug, hidden for years I did not know.

EurekaLog did not find the problem.

Its component is fantastic.
because I found 3 more errors here than the one for EurekaLog was correct.

I will still do some more tests

for now I'm stuck on the question of showing my own Custom Dialog
http://forum.madshi.net/viewtopic.php?f=4&t=28497
Did you see anything for me ?

Did you get to test with Delphi 2010 + madExcept Trial 4.0.19?
luciano_f
 
Posts: 23
Joined: Thu Feb 01, 2018 5:11 pm

Re: It is showing an Error where it does not exist.

Postby madshi » Sun Feb 04, 2018 7:32 pm

I'll reply in the other thread when I had the time to test. It's weekend!
madshi
Site Admin
 
Posts: 9719
Joined: Sun Mar 21, 2004 5:25 pm

Re: It is showing an Error where it does not exist.

Postby luciano_f » Sun Feb 04, 2018 9:07 pm

Yes it's weekend and I confess to you that I'm amazed you're answering my topics.

I did post today but I did not expect you to respond for being weekend, sorry.

Besides having a great product, it has great support.

I can only give you congratulations and success.
luciano_f
 
Posts: 23
Joined: Thu Feb 01, 2018 5:11 pm


Return to madExcept

Who is online

Users browsing this forum: No registered users and 4 guests

cron