Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
How to terminate application on libcef exception?
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
How to terminate application on libcef exception?
Sometimes there are libcef exceptions and program hangs with message "libcef exception...".
How to terminate application on that exception?
How to terminate application on that exception?
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to terminate application on libcef exception?
If you find a bug in CEF4Delphi, please report it and provide all the details you can.
If that issue can be reproduced with any of the demos then show the steps to reproduce it.
In some cases it's necessary to provide a minimal demo in order to reproduce that error.
In any case, please share your findings with the community to fix it as soon as possible.
libcef exceptions and programs hanging shouldn't happen but if your application can't avoid them you can use a "watchdog" process that checks if the main application has problems and close all their processes if it hangs.
If that issue can be reproduced with any of the demos then show the steps to reproduce it.
In some cases it's necessary to provide a minimal demo in order to reproduce that error.
In any case, please share your findings with the community to fix it as soon as possible.
libcef exceptions and programs hanging shouldn't happen but if your application can't avoid them you can use a "watchdog" process that checks if the main application has problems and close all their processes if it hangs.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to terminate application on libcef exception?
I made the bot that visits search engines and checks thousands positions of thousands websites. It works on my notebook but once or twice a day it hangs on my zero client (Via Eden 1Ghz, 2gb RAM, 2GB SSD, WindowsXP SP3) with message "libcef exception". I don't know the reason and just want to terminate all the processes and start program again.
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to terminate application on libcef exception?
Using Windows XP means that you use the OldCEF4Delphi component which includes a very old CEF verison.
Many of the old CEF issues are now fixed and your application should be much more stable if you upgrade.
Chromium is known to use a lot of RAM and that PC only has 2Gb. This issue could also be caused by running out of memory.
Use the CEF log functions to add some custom information about the code that may give problems.
Many of the old CEF issues are now fixed and your application should be much more stable if you upgrade.
Chromium is known to use a lot of RAM and that PC only has 2Gb. This issue could also be caused by running out of memory.
Use the CEF log functions to add some custom information about the code that may give problems.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to terminate application on libcef exception?
Please tell me how to do thatUse the CEF log functions
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to terminate application on libcef exception?
Add these lines before the GlobalCEFApp.StartMainProcess call in the DPR file :
Then call CefDebugLog with a text message every time you need to add some information to the debug.log file.
If the application crashes you can open the debug.log file to see what was the last text message.
If you want extra information in the log set GlobalCEFApp.LogSeverity to LOGSEVERITY_VERBOSE.
LOGSEVERITY_INFO and LOGSEVERITY_VERBOSE are defined in uCEFConstants.pas
Code: Select all
GlobalCEFApp.LogFile := 'debug.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
If the application crashes you can open the debug.log file to see what was the last text message.
If you want extra information in the log set GlobalCEFApp.LogSeverity to LOGSEVERITY_VERBOSE.
LOGSEVERITY_INFO and LOGSEVERITY_VERBOSE are defined in uCEFConstants.pas
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to terminate application on libcef exception?
I started to use ChromiumOSR and ... no exceptions now.
P.S. Also hangs with exceptions...
P.S. Also hangs with exceptions...
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to terminate application on libcef exception?
But I found out that application does not close correctly.
When I run my program, open new windows and close them, and repeat it few times, suddenly"libcef exception" begin on opening new window. And it will continue on the next cycle of running my program. But if I restart computer, libcef exception does not occur.
So I think there is a problem when I terminate my program. Maybe I should close browser, free memory or something like this and after this terminate program...
When I run my program, open new windows and close them, and repeat it few times, suddenly"libcef exception" begin on opening new window. And it will continue on the next cycle of running my program. But if I restart computer, libcef exception does not occur.
So I think there is a problem when I terminate my program. Maybe I should close browser, free memory or something like this and after this terminate program...
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to terminate application on libcef exception?
When I try to terminate my program clicking X button, I see the message
APPCRASH gdi32.dll 6.3.9600.17246
53dc6153 c0000005 000266a4
APPCRASH gdi32.dll 6.3.9600.17246
53dc6153 c0000005 000266a4
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: How to terminate application on libcef exception?
I am trying to close my program with this procedure
But now on close program I see message Access violation
Code: Select all
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if CefSingleProcess then
begin
Chromium1.Load('about:blank');
Chromium2.Load('about:blank');
end;
CanClose := True;
end;