Skip to content

Javascript not working in CEF3 when running with --single-process #477

Closed

Description

@bjarteskogoy

Activity

  1. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    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?

  2. bjarteskogoy commented on Sep 15, 2014

    @bjarteskogoy
    Author

    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.

  3. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    For reference the Chromium doco recommends against it http://www.chromium.org/developers/design-documents/process-models#TOC-Single-process

    CefSharp1 is single process, only downside is active development has pretty much stopped.

  4. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    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.

    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

  5. bjarteskogoy commented on Sep 15, 2014

    @bjarteskogoy
    Author

    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?

  6. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    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.

  7. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    Looking at this further, you can limit the number of render processes, which looks like the simplest way.

    settings.CefCommandLineArgs.Add("renderer-process-limit", "1");

    If you add that to the WPF Example and open a number of tabs, it should only show one sub process in task manager. Let me know how that goes.

  8. bjarteskogoy commented on Sep 15, 2014

    @bjarteskogoy
    Author

    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?

  9. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    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.

  10. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    You can debug the render process fairly easily. As it's running independently you'll have to attach to the running process.

    Add

    settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog");

    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.

  11. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    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,

  12. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    I did improved the WCF error handling today.

    Anyways, I'm done for the day, let me know how you go.

  13. bjarteskogoy commented on Sep 15, 2014

    @bjarteskogoy
    Author

    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.

  14. amaitland commented on Sep 15, 2014

    @amaitland
    Member

    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; assignment

  15. bjarteskogoy commented on Sep 15, 2014

    @bjarteskogoy
    Author

    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.

  16. 20 remaining items

  17. amaitland commented on Oct 10, 2014

    @amaitland
    Member

    @bjarteskogoy Did you make any progress with this?

  18. bjarteskogoy commented on Oct 13, 2014

    @bjarteskogoy
    Author

    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.

  19. amaitland commented on Oct 30, 2014

    @amaitland
    Member

    @bjarteskogoy Can you test the latest JsBinding_Wip? I'm hopeful that #536 will resolve your issues 😄

  20. bjarteskogoy commented on Oct 30, 2014

    @bjarteskogoy
    Author

    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.

  21. modified the milestones: 37.0.0, 33.1.0-pre on Nov 11, 2014
  22. modified the milestones: 3000, 37.0.0 on Nov 19, 2014
  23. bjarteskogoy commented on Nov 24, 2014

    @bjarteskogoy
    Author

    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.

  24. georgiosd commented on Mar 21, 2017

    @georgiosd

    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...

  25. amaitland commented on Mar 21, 2017

    @amaitland
    Member

    It is designed for testing and development purposes, and it may contain bugs that are not present in the other architectures.

    http://www.chromium.org/developers/design-documents/process-models#TOC-Single-process

    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.

  26. georgiosd commented on Mar 22, 2017

    @georgiosd

    @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.

  27. amaitland commented on Mar 22, 2017

    @amaitland
    Member

    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.

  28. georgiosd commented on Mar 22, 2017

    @georgiosd

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions