Disable zygote for CEF on Linux

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Disable zygote for CEF on Linux

Postby wborgsm » Fri Aug 14, 2015 2:03 pm

Hi,

is it possible to disable zygote mode on Linux?

Looks like CefRequestHandler::OnBeforeChildProcessLaunch doesn't work in that mode because my custom switches are not in the command line of the secondary processes, I guess that's normal because they are forked off the zygote instead of executed.

Surprisingly, an extensive web search about disabling zygote on Linux did not bring up nothing. I expected a command line switch like --disable-zygote, but I found only a workaround with --renderer-cmd-prefix but that's for debugging and actually changes the executable to run. I'd like to simply run CEF on Linux with zygote disabled.
wborgsm
Techie
 
Posts: 22
Joined: Mon Feb 23, 2015 7:57 am

Re: Disable zygote for CEF on Linux

Postby magreenblatt » Fri Aug 14, 2015 4:01 pm

What are you trying to do? Why are you sending different command-line flags to sub-processes directly?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Disable zygote for CEF on Linux

Postby wborgsm » Sat Aug 15, 2015 8:24 am

ChromiumFX has a rpc layer and the command line flag I am sending has the name of a pipe for the render process to connect back to the browser process. Every render process gets a different pipe name. I need that pipe before CEF is even initialized so I can't use the CEF built-in ipc channel.

I am under the impression the zygote process' sole purpose is to support their package update model on Linux. From quotes like "On Linux, for Chromium, this [save time and share extra memory pages] is not the point, and measurements suggest that the time and memory savings are minimal or negative" [1] or "This solution is both clever and an ugly hack" [2] and "why we waste memory on this zygote process launcher and have extra buggy codepaths just to support an inferior update model" [2], it looks like they are not even very happy with that solution.

So, since that package update problem is chrome specific and doesn't exist for CEF applications, it would be nice to have the ability to disable the whole zygote thing and run in "normal" mode.

[1] https://code.google.com/p/chromium/wiki/LinuxZygote
[2] http://neugierig.org/software/chromium/ ... ygote.html
wborgsm
Techie
 
Posts: 22
Joined: Mon Feb 23, 2015 7:57 am

Re: Disable zygote for CEF on Linux

Postby videoaudio » Tue Oct 13, 2015 9:20 am

Even I would like to disable zygote mode and spawn render process directly from browser process in my CEF app.

My use case is running multiple instances of CEF based app on single machine. and each app is independent of another, or in other words, each app instance is unaware of another.
This usecase will cause spawning of multiple zygote process instances if I use it as is.

Is there there any way to disable zygote mode using switches or any other means?

That will be really helpful.
videoaudio
Techie
 
Posts: 36
Joined: Tue Feb 17, 2015 10:08 am

Re: Disable zygote for CEF on Linux

Postby videoaudio » Wed Oct 14, 2015 3:35 am

Tried setting "renderer-cmd-prefix" switch at OnBeforeChildProcessLaunch, but its not helping in bypass 'spawning of zygote process'. (even though renderer-cmd-prefix is being passed to renderer)
My CEF app will get spawned N number of times on a same machine machine, causing N number of zygote processes to run, which I really dont need.

Needed help in bypassing zygote process spawning and spawn render process directly from browser process.
Please let me know is there any way I can get this working.
Thanks.
videoaudio
Techie
 
Posts: 36
Joined: Tue Feb 17, 2015 10:08 am

Re: Disable zygote for CEF on Linux

Postby magreenblatt » Wed Oct 14, 2015 10:54 am

You could try changing Chromium code as shown here: https://github.com/atom/electron/issues/1101
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Disable zygote for CEF on Linux

Postby videoaudio » Wed Oct 14, 2015 11:46 pm

Thanks @magreenblatt. I will try this out.
videoaudio
Techie
 
Posts: 36
Joined: Tue Feb 17, 2015 10:08 am

Re: Disable zygote for CEF on Linux

Postby DanKegel » Mon Sep 19, 2016 10:56 am

I'm interested in trying cef3 without zygote, too, but first I checked to see if that flag works on the commandline.
I tried --renderer-cmd-prefix on ubuntu 16.04 just now with
the cefbuilds test app for CEF 3.2704.1434.gec3e9ed
by passing it to cefsimple's commandline:

./cefsimple --renderer-cmd-prefix="xterm -e gdb --eval-command=run --args"

xterm started nicely, and gdb started the renderer, but it aborted with

[0919/085214:FATAL:rand_util_posix.cc(54)] Check failed: success.
#0 0x7ffff330b8de base::debug::StackTrace::StackTrace()
#1 0x7ffff331fd1b logging::LogMessage::~LogMessage()
#2 0x7ffff333a7fb base::RandBytes()
#3 0x7ffff4291ec2 mojo::edk::NodeController::NodeController()
#4 0x7ffff428735b mojo::edk::Core::SetIOTaskRunner()
#5 0x7ffff4281e5f mojo::edk::InitIPCSupport()
#6 0x7ffff583fdd0 IPC::ScopedIPCSupport::ScopedIPCSupport()
#7 0x7ffff5adddcf content::ChildThreadImpl::Init()
#8 0x7ffff59e9fc4 content::RenderThreadImpl::RenderThreadImpl()
#9 0x7ffff59e9f0a content::RenderThreadImpl::Create()
#10 0x7ffff5a14e64 content::RendererMain()
#11 0x7ffff636a507 content::ContentMainRunnerImpl::Run()
#12 0x7ffff6368ff0 content::ContentMain()
#13 0x7ffff3219343 CefExecuteProcess()

which is a bit mystifying. Same thing happens if I try a very
simple wrapper which just does execvp(argv[1], argv+1).

:-(
DanKegel
Mentor
 
Posts: 59
Joined: Fri Nov 08, 2013 12:46 pm

Re: Disable zygote for CEF on Linux

Postby fddima » Mon Sep 19, 2016 2:53 pm

For peoples who only want pass additional parameters into renderer process is exist another way described in issue https://bitbucket.org/chromiumembedded/ ... ra_info-to .
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], tiplip and 51 guests