Renderer Process crashes on startup

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.

Renderer Process crashes on startup

Postby isaacsmile » Thu Aug 24, 2017 8:52 pm

I've integrated CEF 3.3112.1656.g9ec3e42 into my application, which is built on Windows, with Visual Studio 2017.
I've got a custom renderer CefApp implementation & CefClient to hold the message_router.

I have the following settings configured for the browser side (dataDirectory returns a boost::optional<std::wstring>() pointing to the user LOCAL_APP_DATA path):
Code: Select all
 CefSettings settings;
 settings.multi_threaded_message_loop = true;
  settings.command_line_args_disabled = true;
    auto cefDatabaseDirectory = dataDirectory().get() + L"\\" + utf_to_utf<wchar_t, char>(convertServerNameToCEFDataPath(serverName));
    cef_string_utf16_set(cefDatabaseDirectory.data(), cefDatabaseDirectory.size(), &(settings.cache_path), 1);
    auto cefUserDirectory = dataDirectory().get() + L"\\user";
    cef_string_utf16_set(cefUserDirectory.data(), cefUserDirectory.size(), &(settings.user_data_path), 1);
    auto cefLogFile = dataDirectory().get() + L"\\cef_log.txt";
    cef_string_utf16_set(cefLogFile.data(), cefLogFile.size(), &(settings.log_file), 1);
    settings.log_severity = LOGSEVERITY_VERBOSE;



However, once I try to open a windowless browser with the following:
Code: Select all
CefWindowInfo info;
info.SetAsWindowless(nullptr);

CefBrowserSettings settings;
settings.databases = STATE_ENABLED;
settings.universal_access_from_file_urls = STATE_ENABLED;
CefBrowserHost::CreateBrowser(info, cefClient_, "http://example.com" , settings, nullptr);
}


The renderer process crashes on startup, with the following stack trace:
Code: Select all
>   [Inline Frame] libcef.dll!base::debug::BreakDebugger() Line 21   C++
    libcef.dll!logging::LogMessage::~LogMessage() Line 783   C++
    libcef.dll!content::ChildThreadImpl::ConnectChannel(mojo::edk::IncomingBrokerClientInvitation * invitation) Line 406   C++
    libcef.dll!content::ChildThreadImpl::Init(const content::ChildThreadImpl::Options & options) Line 545   C++
    libcef.dll!content::ChildThreadImpl::ChildThreadImpl(const content::ChildThreadImpl::Options & options) Line 383   C++
    libcef.dll!content::RenderThreadImpl::RenderThreadImpl(std::unique_ptr<base::MessageLoop,std::default_delete<base::MessageLoop> > main_message_loop, std::unique_ptr<blink::scheduler::RendererScheduler,std::default_delete<blink::scheduler::RendererScheduler> > scheduler) Line 630   C++
    libcef.dll!content::RenderThreadImpl::Create(std::unique_ptr<base::MessageLoop,std::default_delete<base::MessageLoop> > main_message_loop, std::unique_ptr<blink::scheduler::RendererScheduler,std::default_delete<blink::scheduler::RendererScheduler> > renderer_scheduler) Line 558   C++
    libcef.dll!content::RendererMain(const content::MainFunctionParams & parameters) Line 202   C++
    libcef.dll!content::RunNamedProcessTypeMain(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & process_type, const content::MainFunctionParams & main_function_params, content::ContentMainDelegate * delegate) Line 429   C++
    libcef.dll!content::ContentMainRunnerImpl::Run() Line 705   C++
    libcef.dll!service_manager::MainRun(service_manager::MainParams & params) Line 480   C++
    libcef.dll!service_manager::Main(service_manager::MainParams & params) Line 528   C++
    libcef.dll!content::ContentMain(const content::ContentMainParams & params) Line 19   C++
    libcef.dll!CefExecuteProcess(const CefMainArgs & args, scoped_refptr<CefApp> application, void * windows_sandbox_info) Line 199   C++
    libcef.dll!cef_execute_process(const _cef_main_args_t * args, _cef_app_t * application, void * windows_sandbox_info) Line 198   C++
    MYAPPLICATION.exe!CefExecuteProcess(const CefMainArgs & args, scoped_refptr<CefApp> application, void * windows_sandbox_info) Line 195   C++
    MYAPPLICATION.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * __formal, wchar_t * lpCmdLine, int nCmdShow) Line 207   C++

And the log file looks like the following:
Code: Select all
[0825/133913.440:VERBOSE1:histogram_base.cc(133)] 2 histograms were created before reporting was enabled.
[0825/133913.513:VERBOSE1:node_controller.cc(147)] Initializing node 1604511C8F32D621.A9E0CC1DBBFEF258
[0825/133913.700:VERBOSE1:pref_proxy_config_tracker_impl.cc(154)] 000001999DB8EF60: set chrome proxy config service to 000001999F9DD0E0
[0825/133913.700:VERBOSE1:pref_proxy_config_tracker_impl.cc(281)] 000001999DB8EF60: Done pushing proxy to UpdateProxyConfig
[0825/133913.700:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Aviator' log
[0825/133913.700:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Icarus' log
[0825/133913.700:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Pilot' log
[0825/133913.700:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Rocketeer' log
[0825/133913.700:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Skydiver' log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: DigiCert Log Server
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: DigiCert Log Server 2
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Symantec log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Symantec 'Vega' log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Symantec 'Sirius' log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: WoSign log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Venafi Gen2 CT log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: CNNIC CT log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: StartCom log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Comodo 'Sabre' CT log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Comodo 'Mammoth' CT log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Izenpe log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Venafi log
[0825/133917.278:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Certly.IO log
[0825/133917.278:VERBOSE1:network_connection.cc(30)] Updating NetworkConnection's Cached Data
[0825/133920.945:VERBOSE1:webrtc_internals.cc(109)] Could not get the download directory.
[0825/133920.945:VERBOSE1:node.cc(387)] Merging local ports 1C8E96C76D06EB08.187C01398AA25700@1604511C8F32D621.A9E0CC1DBBFEF258 and 4DC6AD01DDCDF26.E1BBE5F1FC3F022@1604511C8F32D621.A9E0CC1DBBFEF258
[0825/133921.008:VERBOSE1:histogram.cc(376)] Histogram: Compositing.Browser.LayersUpdateTime.0 has bad minimum: 0
[0825/133921.687:VERBOSE1:histogram_base.cc(133)] 2 histograms were created before reporting was enabled.
[0825/133921.689:INFO:cpu_info.cc(50)] Available number of cores: 8
[0825/133921.691:VERBOSE1:node_controller.cc(147)] Initializing node 2825A8949071952C.17639DCDA28955FC
[0825/133926.879:FATAL:child_thread_impl.cc(406)] Check failed: service_manager_connection_.


Stepping through the code (via the pdb + sources files from spotify) It looks like
Code: Select all
InitializeMojoIPCChannel()
in
Code: Select all
CHROMIUM_SRC\content\child\child_thread_impl.cc
fails, returning null. I think this is because none of the command line arguments for a pipe are present (that is is looking for).

Anyway, any help with this would be appreciated; especially if I am doing something trivially wrong!
isaacsmile
Techie
 
Posts: 14
Joined: Thu Aug 24, 2017 8:27 pm

Re: Renderer Process crashes on startup

Postby magreenblatt » Thu Aug 24, 2017 9:42 pm

What do your wWinMain and CefApp implementations look like?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Renderer Process crashes on startup

Postby isaacsmile » Thu Aug 24, 2017 11:30 pm

BrowserApp:
Code: Select all
  class BrowserProcessApp : public CefApp, public CefBrowserProcessHandler {
            public:
                BrowserProcessApp();

                CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override;

                void OnContextInitialized() override;

                void OnBeforeCommandLineProcessing(CefString const&, CefRefPtr<CefCommandLine> command_line) override;
            private:
                IMPLEMENT_REFCOUNTING(BrowserProcessApp);
                DISALLOW_COPY_AND_ASSIGN(BrowserProcessApp);
            };
//and in the .cpp
BrowserProcessApp::BrowserProcessApp() {
}

CefRefPtr<CefBrowserProcessHandler> BrowserProcessApp::GetBrowserProcessHandler() {
    return this;
}

void BrowserProcessApp::OnBeforeCommandLineProcessing(CefString const&, CefRefPtr<CefCommandLine> command_line) {
    // Workaround: https://bitbucket.org/chromiumembedded/cef/issues/1680/windows-2454-crash-on-shutdown-with-multi
    command_line->AppendSwitch("disable-extensions");
}

void BrowserProcessApp::OnContextInitialized() {
    BOOST_LOG_TRIVIAL(debug) << "CEF initialized";
}


And the Renderer App
Code: Select all
 class RendererProcessApp : public CefApp, public CefRenderProcessHandler {
            public:
                RendererProcessApp();

                CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override;

                void OnWebKitInitialized() override;

                void OnContextCreated(
                    CefRefPtr<CefBrowser> browser,
                    CefRefPtr<CefFrame> frame,
                    CefRefPtr<CefV8Context> context) override;

                void OnContextReleased(
                    CefRefPtr<CefBrowser> browser,
                    CefRefPtr<CefFrame> frame,
                    CefRefPtr<CefV8Context> context) override;

                bool OnProcessMessageReceived(
                    CefRefPtr<CefBrowser> browser,
                    CefProcessId source_process,
                    CefRefPtr<CefProcessMessage> message
                ) override;

                void OnBeforeCommandLineProcessing(CefString const&, CefRefPtr<CefCommandLine> command_line) override;
            private:
                CefRefPtr<CefMessageRouterRendererSide> messageRouter_;
                IMPLEMENT_REFCOUNTING(RendererProcessApp);
                DISALLOW_COPY_AND_ASSIGN(RendererProcessApp);
            };

// and the .cpp file

RendererProcessApp::RendererProcessApp() {
}

CefRefPtr<CefRenderProcessHandler> RendererProcessApp::GetRenderProcessHandler() {
    return this;
}

void RendererProcessApp::OnWebKitInitialized() {
    CefMessageRouterConfig config;
    messageRouter_ = CefMessageRouterRendererSide::Create(config);
}

void RendererProcessApp::OnContextCreated(
    CefRefPtr<CefBrowser> browser,
    CefRefPtr<CefFrame> frame,
    CefRefPtr<CefV8Context> context) {
    messageRouter_->OnContextCreated(browser, frame, context);
}

void RendererProcessApp::OnContextReleased(
    CefRefPtr<CefBrowser> browser,
    CefRefPtr<CefFrame> frame,
    CefRefPtr<CefV8Context> context) {
    messageRouter_->OnContextReleased(browser, frame, context);
}

bool RendererProcessApp::OnProcessMessageReceived(
    CefRefPtr<CefBrowser> browser,
    CefProcessId source_process,
    CefRefPtr<CefProcessMessage> message) {
    return messageRouter_->OnProcessMessageReceived(browser, source_process, message);
}

void RendererProcessApp::OnBeforeCommandLineProcessing(CefString const&, CefRefPtr<CefCommandLine>) {
}


WinMain
Code: Select all

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
    _In_opt_ HINSTANCE,
    _In_ LPWSTR    lpCmdLine,
    _In_ int       nCmdShow)
{

    boost::locale::localization_backend_manager lbm = boost::locale::localization_backend_manager::global();
    lbm.select("icu"); // always use the ICU backend.

    boost::locale::generator gen(lbm);
    std::locale the_locale = gen(""); // use the users locale

    // ensure their boostified locale is used globally
    std::locale::global(the_locale);

    CefEnableHighDPISupport();

    CefMainArgs main_args(hInstance);
    auto command_line = CefCommandLine::CreateCommandLine();
    command_line->InitFromString(::GetCommandLineW());

    CefRefPtr<CefApp> cefApp;
    if (!command_line->HasSwitch("type")) {
        cefApp = new BrowserProcessApp();
    }
    else if (command_line->GetSwitchValue("type") == "renderer") {
        cefApp = new RendererProcessApp();
    }

    int exit_code = CefExecuteProcess(main_args, cefApp, nullptr);

    if (exit_code >= 0) {
        return exit_code;
    }

    // whole bunch of app initialization, including RegisterApplicationRestart, RegisterApplicationRecovery, WerRegisterFile
    // also OleInitialize, CoInitializeSecurity

    // set cef_settings as above
    CefInitialize(main_args, settings, cefApp.get(), nullptr);
    BOOST_SCOPE_EXIT(settings) {
        CefShutdown();
    } BOOST_SCOPE_EXIT_END;

   // then I create a bunch of windows.
   // after the windows are created, I post a message, in the wndproc for that window I create the CefBrowser instance.
   // then I use a MsgWaitForMultipleObjectsEx-based message pump

   return 0;
}
isaacsmile
Techie
 
Posts: 14
Joined: Thu Aug 24, 2017 8:27 pm

Re: Renderer Process crashes on startup

Postby magreenblatt » Fri Aug 25, 2017 10:23 am

Try moving all boost calls to after the CefExecuteProcess call.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Renderer Process crashes on startup

Postby isaacsmile » Fri Aug 25, 2017 3:56 pm

I've just tried that and it is still crashing in the same place. :(
isaacsmile
Techie
 
Posts: 14
Joined: Thu Aug 24, 2017 8:27 pm

Re: Renderer Process crashes on startup

Postby isaacsmile » Thu Sep 07, 2017 8:57 pm

Investigated further, discovered that it was the setting of the product name that caused the failure (this wasn't in the example pasted above, accidentally missed it, sorry).

Code: Select all

  static const char PRODUCT_VERSION[] = "Example/" " 0.9.1 (dev version)" " Chrome/" MAKE_STRING(CHROME_VERSION_MAJOR) "." MAKE_STRING(CHROME_VERSION_MINOR) "." MAKE_STRING(CHROME_VERSION_BUILD) "." MAKE_STRING(CHROME_VERSION_PATCH);
  cef_string_utf8_to_utf16(PRODUCT_VERSION, sizeof(PRODUCT_VERSION), &(settings.product_version));



I can reproduce this in cefclient, with adding that to cefclient_win.cc, provided you add #include "include/cef_version.h" as well.

I've raised the issue here: https://bitbucket.org/chromiumembedded/ ... process-to
isaacsmile
Techie
 
Posts: 14
Joined: Thu Aug 24, 2017 8:27 pm


Return to Support Forum

Who is online

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