You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Javascript not working in CEF3 when running with --single-process #477
I don't believe the design as it stands will work with --single-process, the browser sub process is actually a separate executable i.e. CefSharp.BrowserSubprocess. I think single process only works if you have the client and sub process integrated together, where we have them split into two. This simplifies the whole integration process.
CEF3 supports a single-process run mode for debugging purposes via the "--single-process" command-line flag
I think single process was really only intended for debugging purposes. Is there are particular need for --single-process?
Need is relative ... And maybe we should have designed our software differently, but for now we have a lot of browsers embedded at the same time. Our software is used a lot on terminal servers, and I'm not sure how the administrators are going to appreciate a thousand chromium processes. I might just be paranoid, and I don't know if memory consumption would be any different alltogether.
Quick look to implement yourself you'd have to implement CefRenderProcessHandler in CefSharpApp and then plumb together all the JS Binding. Probably about a half day to implement.
Ok. Is the --process-per-site mode supported? Would this give me just one process even if I have 20 browsers and load content from the same host with a custom scheme handler?
You'd have to try it to know for sure. Theoretically long as the scheme + host were the same it should just reuse the browser render process. The JS Binding may need some tweaking.
This would be perfect. Works OK in the sample.
I get a lot of OnRenderProcessTerminated when there are simultaneous javascript calls from many browsers. Any thoughts on that? Where would I go to find out what's happening?
In the bin directory Cef should generate a debug.log file. If you change CefSettings.LogSeverity you can get it to output a whole load of debugging information. I'd start there.
When the message box appears, go "Debug->Attach to Process" in VS, find CefSharp.BrowserSubprocess.exe and attach to that. Add some breakpoints and then press ok on the message box.
It could be something to do with WCF and the channel callback, though I'd need sample code to properly debug if that's the case.
Seems like there's no difference. The only difference may be that the last of the simultaneous javascript calls succeeds, but not sure. I believe it's some kind of WCF related thing. I get a WCF error, but translated to Norwegian (courtesy of .Net). It suggests enabling exception details.
A quick test seems to prove otherwise, but I'll check if there might be other causes now. If the bug is still there I'll try to make a project reproducing it.
Is there an example for single-process or at least some docs on how to make it work? I'm getting weird random crashes with it, and I can't even attach the debugger...
I'm getting weird random crashes with it, and I can't even attach the debugger...
CefSharp doesn't support single process mode, most of it's features are implemented in it's custom subprocess. CEF doesn't support it either (no bugs will be fixed). If you search on http://magpcss.org/ceforum/index.php you'll see nothing but problems.
@amaitland Thanks, yes, I see now... too bad - I'm spawning a lot of browsers and resource usage is a primary concern. It seems that single process was the most efficient - and most unstable.
Any idea how CEF1 would fair in terms of resources? I don't mind that it won't have the latest features, I only need some basic rendering and Javascript execution. If I read correctly, it's at Chromium 25.
Yes, I have looked at them extensively. However I'm thinking it's a risk to control too many pages from one process. If the process crashes for whatever reason, they're all orphaned/dead. The renderer crashing is not a problem of course.
I also heard that the network requests all go through one thread which would slow things down for a lot of pages. I haven't been able to verify that though, so it could be misinformation.
I guess I should run some more tests before committing.
Activity
amaitland commentedon Sep 15, 2014
I don't believe the design as it stands will work with
--single-process, the browser sub process is actually a separate executable i.e.CefSharp.BrowserSubprocess. I think single process only works if you have the client and sub process integrated together, where we have them split into two. This simplifies the whole integration process.I think single process was really only intended for debugging purposes. Is there are particular need for
--single-process?bjarteskogoy commentedon Sep 15, 2014
Need is relative ... And maybe we should have designed our software differently, but for now we have a lot of browsers embedded at the same time. Our software is used a lot on terminal servers, and I'm not sure how the administrators are going to appreciate a thousand chromium processes. I might just be paranoid, and I don't know if memory consumption would be any different alltogether.
amaitland commentedon Sep 15, 2014
For reference the Chromium doco recommends against it http://www.chromium.org/developers/design-documents/process-models#TOC-Single-process
CefSharp1is single process, only downside is active development has pretty much stopped.amaitland commentedon Sep 15, 2014
Quick look to implement yourself you'd have to implement
CefRenderProcessHandlerinCefSharpAppand then plumb together all theJS Binding. Probably about a half day to implement.Relevant files to start with:
https://github.com/cefsharp/CefSharp/blob/JsBinding_WIP/CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.h
https://github.com/cefsharp/CefSharp/blob/JsBinding_WIP/CefSharp.Core/Internals/CefSharpApp.h
bjarteskogoy commentedon Sep 15, 2014
Ok. Is the --process-per-site mode supported? Would this give me just one process even if I have 20 browsers and load content from the same host with a custom scheme handler?
amaitland commentedon Sep 15, 2014
You'd have to try it to know for sure. Theoretically long as the scheme + host were the same it should just reuse the browser render process. The JS Binding may need some tweaking.
amaitland commentedon Sep 15, 2014
Looking at this further, you can limit the number of render processes, which looks like the simplest way.
If you add that to the
WPF Exampleand open a number of tabs, it should only show one sub process in task manager. Let me know how that goes.bjarteskogoy commentedon Sep 15, 2014
This would be perfect. Works OK in the sample.
I get a lot of OnRenderProcessTerminated when there are simultaneous javascript calls from many browsers. Any thoughts on that? Where would I go to find out what's happening?
amaitland commentedon Sep 15, 2014
In the bin directory Cef should generate a
debug.logfile. If you changeCefSettings.LogSeverityyou can get it to output a whole load of debugging information. I'd start there.amaitland commentedon Sep 15, 2014
You can debug the render process fairly easily. As it's running independently you'll have to attach to the running process.
Add
When the message box appears, go "Debug->Attach to Process" in VS, find
CefSharp.BrowserSubprocess.exeand attach to that. Add some breakpoints and then press ok on the message box.It could be something to do with
WCFand the channel callback, though I'd need sample code to properly debug if that's the case.amaitland commentedon Sep 15, 2014
More changes are in the pipeline, so it maybe worth using this branch instead https://github.com/amaitland/CefSharp/commits/JsBinding/Wip2
It has my latest changes,
amaitland commentedon Sep 15, 2014
I did improved the
WCFerror handling today.Anyways, I'm done for the day, let me know how you go.
bjarteskogoy commentedon Sep 15, 2014
I get this one in the log: ERROR:ipc_channel_win.cc(404)] pipe error: 232
Seems like there are no crashes when running on your branch, but the scripts aren't executed anyway.
amaitland commentedon Sep 15, 2014
Comment out this line and see what you get
https://github.com/amaitland/CefSharp/blob/JsBinding/Wip2/CefSharp.BrowserSubprocess/CefRenderProcess.cs#L31
Leave the
parentBrowserId = browser.BrowserId;assignmentbjarteskogoy commentedon Sep 15, 2014
Seems like there's no difference. The only difference may be that the last of the simultaneous javascript calls succeeds, but not sure. I believe it's some kind of WCF related thing. I get a WCF error, but translated to Norwegian (courtesy of .Net). It suggests enabling exception details.
20 remaining items
amaitland commentedon Oct 10, 2014
@bjarteskogoy Did you make any progress with this?
bjarteskogoy commentedon Oct 13, 2014
No sorry. I'll be back on the project using cefsharp some time this week. I hope I'll be able to spend som time on this then.
amaitland commentedon Oct 30, 2014
@bjarteskogoy Can you test the latest
JsBinding_Wip? I'm hopeful that #536 will resolve your issues 😄bjarteskogoy commentedon Oct 30, 2014
A quick test seems to prove otherwise, but I'll check if there might be other causes now. If the bug is still there I'll try to make a project reproducing it.
bjarteskogoy commentedon Nov 24, 2014
I think this one is OK. A mix of the issue fixed in #536 and some confusion regarding when you can register js objects seems be the cause for this.
georgiosd commentedon Mar 21, 2017
Hey guys,
Is there an example for single-process or at least some docs on how to make it work? I'm getting weird random crashes with it, and I can't even attach the debugger...
amaitland commentedon Mar 21, 2017
http://www.chromium.org/developers/design-documents/process-models#TOC-Single-process
CefSharpdoesn't support single process mode, most of it's features are implemented in it's custom subprocess.CEFdoesn't support it either (no bugs will be fixed). If you search on http://magpcss.org/ceforum/index.php you'll see nothing but problems.georgiosd commentedon Mar 22, 2017
@amaitland Thanks, yes, I see now... too bad - I'm spawning a lot of browsers and resource usage is a primary concern. It seems that single process was the most efficient - and most unstable.
Any idea how CEF1 would fair in terms of resources? I don't mind that it won't have the latest features, I only need some basic rendering and Javascript execution. If I read correctly, it's at Chromium 25.
amaitland commentedon Mar 22, 2017
Chromium does have other process models to choose from.
CEF1 is before my time. You might be better to look at geckofx, from memory it has a single process model.
georgiosd commentedon Mar 22, 2017
Yes, I have looked at them extensively. However I'm thinking it's a risk to control too many pages from one process. If the process crashes for whatever reason, they're all orphaned/dead. The renderer crashing is not a problem of course.
I also heard that the network requests all go through one thread which would slow things down for a lot of pages. I haven't been able to verify that though, so it could be misinformation.
I guess I should run some more tests before committing.
Thanks for the link! I'll check it out!