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.
Renderer Process doesn't end after app has closed
Renderer Process doesn't end after app has closed
Hi, I have a very big problem with the multiprocess system of CEF. We are currently in the process of integrating chromium into our application. Now we have noticed, however, that the rendering process does not end after exiting the application, but continues to run headlessly. However, I can't explain why the rendering process gets stuck. I also tried to define a dedicated executable for the subprocesses, but that didn't work either. The integration of chromium into the dpr file was done correctly. In a test application this also works perfectly, only in our existing application I could determine the problem.
- salvadordf
- Posts: 4374
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Renderer Process doesn't end after app has closed
Hi,
Are you using the latest CEF4Delphi version?
Are you calling TChromium.CloseBrowser and waiting until the TChromium.BeforeClose event is triggered in all your browsers before closing your app ?
For a detailed description of this "destruction sequence" read the code comments in the CEF4Delphi demo that is similar to your app.
There are slight differences in that sequence depending on the components you use or how you use them.
Please, also check that GlobalCEFApp is freed in the last line of your DPR file.
If you already do all these things and you still see an orphan subprocess give me more details about your app :
Are you using the latest CEF4Delphi version?
Are you calling TChromium.CloseBrowser and waiting until the TChromium.BeforeClose event is triggered in all your browsers before closing your app ?
For a detailed description of this "destruction sequence" read the code comments in the CEF4Delphi demo that is similar to your app.
There are slight differences in that sequence depending on the components you use or how you use them.
Please, also check that GlobalCEFApp is freed in the last line of your DPR file.
If you already do all these things and you still see an orphan subprocess give me more details about your app :
- Components used.
- Number of browsers your app creates.
- Do you use TChromium in OSR mode or normal mode ?
- Delphi version
- Windows version
- Can you replicate this with any of the demos?
Re: Renderer Process doesn't end after app has closed
It seems as if I am not calling TChromium.CloseBrowser. I call GlobalCEFApp.free in finalization, is that too late? The strange thing is that it works in my test application without any problems, even without CloseBrowser.
I have now also put a CloseBrowser(True) into FormClose, but the rendering process still hangs.
I have now also put a CloseBrowser(True) into FormClose, but the rendering process still hangs.
- salvadordf
- Posts: 4374
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Renderer Process doesn't end after app has closed
This is the destruction sequence in the MiniBrowser demo :
If you close your app before receiving the TChromium.OnBeforeClose event you may have shutdown problems.
- 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
- 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
- 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
If you close your app before receiving the TChromium.OnBeforeClose event you may have shutdown problems.
- salvadordf
- Posts: 4374
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Renderer Process doesn't end after app has closed
The previous sequence is used here :
https://github.com/salvadordf/CEF4Delph ... rowser.pas
https://github.com/salvadordf/CEF4Delph ... rowser.pas