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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

How to debug CEF4Delphi?

thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: How to debug CEF4Delphi?

Post by thefunkyjoint »

salvadordf wrote: Sun Oct 08, 2017 1:16 pm
thefunkyjoint wrote: Sun Oct 08, 2017 12:48 pm I'm still having this issue of the app does not close properly, but what is bothering more is some random AV and crashes of the app during its use, and this did not happen with DCEF3.
I'm activating the verbose logfile to try to find out something.
Crashes during its use? That's very unusual.
Are they happening when you free one of the TChromium components?
Maybe a few seconds after you free one of the TChromium?

Try to open that website with this SimpleBrowser :
https://www.briskbard.com/SimpleBrowser.zip

Also try to open it with the official CEF3 Sample Application :
http://opensource.spotify.com/cefbuilds ... nt.tar.bz2
Hi,

Currently i'm monitoring 2 different issues :

1 - Crash on app closing : you already told me instructions and i'm working on it

2 - App 'freezing' randomly and having to close it on task manager ; this one is the hardest to identify the cause and fix... any ideas ? My app usually works in a very few different websites, usually 2 or 3 different ones, but in sub-pages of these sites.

Thank you again !
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to debug CEF4Delphi?

Post by salvadordf »

Hi,
thefunkyjoint wrote: Sun Oct 08, 2017 10:06 pm 2 - App 'freezing' randomly and having to close it on task manager ; this one is the hardest to identify the cause and fix... any ideas ? My app usually works in a very few different websites, usually 2 or 3 different ones, but in sub-pages of these sites.
It's hard to tell without more details.

I've only seen something like this when you open too many web pages.
Eventually all the CPU cores run at 100% or the app reaches the maximum amount of memory the OS can assign to that process.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: How to debug CEF4Delphi?

Post by thefunkyjoint »

Still looking for the cause of the issue of my app crash randomly, no clues so far.

About the crash on close, i could not solve yet, but if i simply comment this line :
GlobalCEFApp.Free;

The crash won't happen and somehow it seems the app closes normally. What problem can happen if i did not call GlobalCEFApp.Free ? Won't it be release even my app EXE is closed ?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to debug CEF4Delphi?

Post by salvadordf »

thefunkyjoint wrote: Tue Oct 10, 2017 1:05 pm About the crash on close, i could not solve yet, but if i simply comment this line :
GlobalCEFApp.Free;

The crash won't happen and somehow it seems the app closes normally. What problem can happen if i did not call GlobalCEFApp.Free ? Won't it be release even my app EXE is closed ?
If GlobalCEFApp is not destroyed, your app will have memory leaks and the main process won't shutdown CEF correctly.

If you can't release the source code of your application, try to replicate the error in a new simple project and I'll be able to help you.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: How to debug CEF4Delphi?

Post by thefunkyjoint »

salvadordf wrote: Tue Oct 10, 2017 1:27 pm
thefunkyjoint wrote: Tue Oct 10, 2017 1:05 pm About the crash on close, i could not solve yet, but if i simply comment this line :
GlobalCEFApp.Free;

The crash won't happen and somehow it seems the app closes normally. What problem can happen if i did not call GlobalCEFApp.Free ? Won't it be release even my app EXE is closed ?
If GlobalCEFApp is not destroyed, your app will have memory leaks and the main process won't shutdown CEF correctly.

If you can't release the source code of your application, try to replicate the error in a new simple project and I'll be able to help you.
What makes the issue harder to solve is the fact it won't happen everytime and even not in every machines. In my environment this won't happen, but specially in machines with Windows 7 it's more often.
User avatar
liangchuying
Posts: 5
Joined: Tue May 14, 2024 10:05 am

Re: How to debug CEF4Delphi?

Post by liangchuying »

Hello Salvador,

It's a little confusing, but my problem is similar, I'm trying to open the app. A pop-up window appears. Access violation at address 00C37211 in module xxxxxx.exe'. Read of address 00000000. Computer cpu is full 100%. I can not locate the problem where, but I read the previous several times the article, basically said is the initialization problem

procedure GlobalCEFApp_OnWebKitInitialized;
begin
TCefRTTIExtension. Register('spapi', TSPApiMsg);
end;

function cefCreateGlobalCEFApp: TCefApplication;
begin
if GlobalCEFApp = nil then
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp. Locale := 'zh-CN';
GlobalCEFApp. AcceptLanguageList := 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7';
// GlobalCEFApp. Cache := AppPath + '\cache';
//GlobalCEFApp. UserDataPath := AppPath + '\User Data';

GlobalCEFApp. OnWebKitInitialized := GlobalCEFApp_OnWebKitInitialized;
GlobalCEFApp. OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived;

end;
Result := GlobalCEFApp;
end;
User avatar
liangchuying
Posts: 5
Joined: Tue May 14, 2024 10:05 am

Re: How to debug CEF4Delphi?

Post by liangchuying »

And mistakes happen occasionally, so I can't pinpoint the problem
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to debug CEF4Delphi?

Post by salvadordf »

Set GlobalCEFApp.SingleProcess to True before the GlobalCEFApp.StartMainProcess call in the DPR file and debugging will be easier.

The single process mode has other issues but it allows us to debug all the code. That mode has a shutdown issue but ignore it while debugging.

In any case, it's impossible to know what's happening without code. Modify one of the demos and attach the code here to reproduce that issue in my computer.
User avatar
liangchuying
Posts: 5
Joined: Tue May 14, 2024 10:05 am

Re: How to debug CEF4Delphi?

Post by liangchuying »

Sorry, this is hard for me, because I don't know where the problem is, so I can't demo it :lol:
Post Reply