Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support all standard chromium process models #6903

Closed
krillr opened this issue Aug 19, 2016 · 13 comments
Closed

Support all standard chromium process models #6903

krillr opened this issue Aug 19, 2016 · 13 comments

Comments

@krillr
Copy link

krillr commented Aug 19, 2016

By default Electron appears to use the process-per-site-instance process model. It would be best to allow developers to choose between the available models, for example I would much like to use the single-process model while others would likely prefer the process-per-site model. Enabling the command-line switch for this setting in chromium would be ideal.

@sedwards2009
Copy link

Electron has a main process which is roughly just nodejs and it can create new windows which have a process each. That is the whole model. The concept of 'site' or 'per site' doesn't make much sense here as Electron isn't oriented around showing sites like a web browser.

@krillr
Copy link
Author

krillr commented Aug 19, 2016

From what I understood, Electron is a wrapper around libchromiumcontent, which in turn handles all the windows -- Electron just makes calls into the chromium instance to create BrowserWindows, and BrowserWindows are just nodejs objects bound to chromium windows.

Is that incorrect?

@sedwards2009
Copy link

It is windows with nodejs support and some other Electron APIs baked. But yes, you're description @krillr sounds about right.

@krillr
Copy link
Author

krillr commented Aug 19, 2016

So what I'm requesting is that libchromium be configurable to use any one of its many process models. In Electron's current state, libchromium uses its default process-per-site-instance model. Every time a dialog is opened, a new window is spawned, etc -- a new process is spawned to render that window. This makes sense in the context of a web browser, but leads to unnecessary memory usage in a desktop application. Making this configurable would allow those of us whose apps don't need advanced security models like process-per-site-instance to optimize our applications.

@anaisbetts
Copy link
Contributor

Single process model doesn't work with node.js and is also super busted / bitrotted

@krillr
Copy link
Author

krillr commented Aug 19, 2016

Ok, well the process-per-site model would work just as well, and it is fully supported by chromium.

@krillr
Copy link
Author

krillr commented Aug 19, 2016

Huh, I guess passing the relevant chrome options to electron "just works" -- not sure why I didn't just try that.

Needs docs I guess.

@zcbenz
Copy link
Member

zcbenz commented Aug 22, 2016

The process model in Electron is different from any process model in Chromium, the renderer process is forced to restart for every navigation, otherwise leaks would happen. This is because Node is currently designed to have only one instance in one process, and it doesn't cleanup all the resources one JavaScript environment is destroyed.

I'm closing this as won't fix since current process model is restricted by the design of Node.

@zcbenz zcbenz closed this as completed Aug 22, 2016
@krillr
Copy link
Author

krillr commented Aug 22, 2016

If that's the case, how come the flag "--process-per-site" works fine -- it
just isn't documented?

On Sunday, August 21, 2016, Cheng Zhao notifications@github.com wrote:

Closed #6903 #6903.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#6903 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAqCO2M9TDh5JRNSuY2m1hgOIAEx85BEks5qiQEmgaJpZM4JooF9
.

@anaisbetts
Copy link
Contributor

@krillr I suspect it doesn't actually work fine - if you tried:

  1. Create two windows pointed at the same site
  2. require a native node module in one
  3. try to require that module in the 2nd window

This would blow up

@krillr
Copy link
Author

krillr commented Aug 22, 2016

It doesn't blow up, but it does stop JS execution in the second window.
Interesting...

On Mon, Aug 22, 2016 at 10:43 AM, Paul Betts notifications@github.com
wrote:

@krillr https://github.com/krillr I suspect it doesn't actually work
fine - if you tried:

  1. Create two windows pointed at the same site
  2. require a native node module in one
  3. try to require that module in the 2nd window

This would blow up


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#6903 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAqCO2PAnzl7ZExxw4TZjIUm_bSWaclWks5qid-zgaJpZM4JooF9
.

@ahmedmohamedali
Copy link
Contributor

Hi @zcbenz ,

It isn't possible to have chromium process model in sandboxed renderers ?
Thanks.

@bughit
Copy link
Contributor

bughit commented Aug 22, 2018

the renderer process is forced to restart for every navigation, otherwise leaks would happen

@zcbenz Is that still necessary when node integration is off?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants