Idle subprocess created for each popup

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

Idle subprocess created for each popup

Postby oxbow » Fri Oct 17, 2014 1:29 am

When my JS calls window.open(), i get my custom popup. I've assigned false for noJavascriptAccess to reuse the existing renderer process in OnBeforePopup(). And window.opener works and I have confirmed the existing renderer process is being used for the new browser popup window. But task manager shows that I create a new renderer process for each popup. Killing the extra process confirms it is not being used. Is this a common problem? Is there some common gotcha i'm falling into? The process gets started same time my code calls show for the new window, not before or after.
I'm using version CEF 3.1916.1781, Chromium 35.0.1916.138 on Windows.
I have created a cefglue DLL that can be integrated into any app to add the embedded browser. It's built with a WPF XAML window frame, with a WPF UserControl object that hosts the WinForms CefGlue control. In OnBeforePopup I create all three of these objects for the new window, and everything else but the CefBrowser, which I let CEF create and I attach it in OnAfterCreated. The new CefClient object is passed back to CEF when OnBeforePopup returns. And my subprocess is written as a separate, small executeable called BrowserSubProcess.exe. This all works great. I've even implemented the functionality for JS window.resizeTo() which works on self, child and even parent windows. But I want to find out why I am getting unused renderer subprocesses created for popups. They do terminate when the browser window closes, but are not used while present. Only the original renderer process is ever used.
Thx, Peter
oxbow
Newbie
 
Posts: 8
Joined: Fri Oct 17, 2014 12:20 am

Re: Idle subprocess created for each popup

Postby magreenblatt » Fri Oct 17, 2014 9:49 am

What is the command line for the newly spawned process? You can use a tool like Process Explorer to find out.
magreenblatt
Site Admin
 
Posts: 12384
Joined: Fri May 29, 2009 6:57 pm

Re: Idle subprocess created for each popup

Postby oxbow » Fri Oct 17, 2014 12:13 pm

I'm printing my command line parameters to an IPC channel I created to the browser process and then to a common console, so there they are ... I'm showing 2 sets. The original renderer process for the root browser window, and the renderer process created for the popup. bid = CefBrowser.Identifier, fid = CefFrame.Identifier
---> root browser
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: <<<<Command line args>>>>
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: .\CefSubProcess.exe
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --type=renderer
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --disable-application-cache
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --no-sandbox
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --register-pepper-plugins=.\hello_world_gles.dll;application/x-nacl
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --lang=en-US
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --lang=en-US
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --log-severity=info
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --enable-threaded-compositing
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --enable-delegated-renderer
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --disable-accelerated-video-decode
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --enable-software-compositing
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: --channel=5440.1.119816849\1280670334
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: /prefetch:673131151
<SubProc/bid=1,fid=1>:[RenderProcessHandler]: <<<<End of command line>>>>

----> popup browser
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: <<<<Command line args>>>>
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: .\CefSubProcess.exe
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --type=renderer
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --disable-application-cache
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --no-sandbox
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --register-pepper-plugins=.\hello_world_gles.dll;application/x-nacl
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --lang=en-US
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --lang=en-US
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --log-severity=info
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --enable-threaded-compositing
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --enable-delegated-renderer
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --disable-accelerated-video-decode
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --enable-software-compositing
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: --channel=5440.2.1275859029\1872542343
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: /prefetch:673131151
<SubProc/bid=2,fid=1>:[RenderProcessHandler]: <<<<End of command line>>>>

thanks, Peter
oxbow
Newbie
 
Posts: 8
Joined: Fri Oct 17, 2014 12:20 am

Re: Idle subprocess created for each popup

Postby magreenblatt » Fri Oct 17, 2014 1:14 pm

Can you test with a newer branch (2062 or trunk) to see if the problem has been resolved?
magreenblatt
Site Admin
 
Posts: 12384
Joined: Fri May 29, 2009 6:57 pm

Re: Idle subprocess created for each popup

Postby oxbow » Fri Oct 17, 2014 5:05 pm

OK. Thanks. I will upgrade. I think this next comment is related. Not sure.
I'm also seeing cases where success callbacks for persistent=true cefQuery's from popups are failing to get delivered, and have seen other cases where the success callback events get delivered to the root window instead of the originating popup. Trying to debug to see why.
oxbow
Newbie
 
Posts: 8
Joined: Fri Oct 17, 2014 12:20 am

Re: Idle subprocess created for each popup

Postby oxbow » Fri Oct 17, 2014 5:36 pm

Interesting. I have confirmed the renderer processes I call idle are getting callback responses with no window to render to. I create what I call a channel from browser proc to renderer proc using a persistent query callback. This is created with CefBrowser with ID x (ex. 4) when the page is loaded by calling cefQuery( req, true, ...). I then send a separate cefQuery from the same CefBrowser window via explicit trigger (click a button). This time the CefBrowser is identified as x+1 (ex. 5). It's the same browser window, so the CefBrowser ID should be the same, but it's not. The browser is supposed to respond using the previously created channel, but that sends the response to CefBrowser ID x. It never arrives where it is suppose to at CefBrowser x+1. I put the debugger on the "idle" renderer process and confirmed the message on channel for CefBrowser x did arrive there. But this extra renderer process has no window. It's kind of orphaned. If I kill the process using task manager, it has no impact on my app.
So something is happening that creates a new renderer process, runs my onLoad() function (to create the channel x) then hands the popup document to the original renderer process and creates another CefBrowser object x+1 and renders the document there.
Let's see what happens after I upgrade my Cef/CefGlue.
oxbow
Newbie
 
Posts: 8
Joined: Fri Oct 17, 2014 12:20 am

Re: Idle subprocess created for each popup

Postby oxbow » Tue Oct 28, 2014 3:59 pm

Issue solved.
I have not yet upgraded my version of CEF in my app as suggested (Other priorities :) ). But I did find the root cause of the ghost subprocesses.
I found out 2 CefBrowser objects were getting created for the popups. In the LifeSpanHandler.OnBeforePopup() I am calling SetAsChild(Handle, Rect). The Handle is that of the container I put the CefBrowser into. But my OnHandleCreated() handler in the Control creates the CefBrowser object (taken from CefGlue sample code, I believe) - seems to work well for the root browser window. For popups, a (ghost) CefBrowser object was being created when I tried to get the container Handle for SetAsChild() _before_ the CEF library created the browser for me (again). So now I block the creation of the CefBrowser in the handler if for a popup. This solved the ghost subprocess issue.
oxbow
Newbie
 
Posts: 8
Joined: Fri Oct 17, 2014 12:20 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 25 guests