CEF crashes during CefExecuteProcess on Win10 64bit

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.

CEF crashes during CefExecuteProcess on Win10 64bit

Postby lolovo » Tue Jun 27, 2017 10:02 am

Good day!

CEF 3.3071.1644.g408afd1_windows32 crashes during CefExecuteProcess:

console output message:
Code: Select all
[0627/144955.862:INFO:media_foundation_video_encode_accelerator_win.cc(329)] Windows versions earlier than 8 are not supported.
[0627/145040.485:FATAL:font_warmup_win.cc(397)] Check failed: patched == 0.


backtrace & place of crash:
Code: Select all
  DWORD patched =
      g_iat_patch_open_sc_manager.Patch(L"dwrite.dll", service_provider_dll,
                                        "OpenSCManagerW", OpenSCManagerWPatch);
  DCHECK(patched == 0);

....

   libcef.dll!logging::LogMessage::~LogMessage()Line 759   C++
    libcef.dll!content::PatchServiceManagerCalls()Line 399   C++
    libcef.dll!content::InitializeDWriteFontProxy()Line 50   C++
    libcef.dll!content::RendererMainPlatformDelegate::PlatformInitialize()Line 60   C++
    libcef.dll!content::RendererMain(const content::MainFunctionParams & parameters)Line 165   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 438   C++
    libcef.dll!content::ContentMainRunnerImpl::Run()Line 740   C++
    libcef.dll!service_manager::MainRun(service_manager::MainParams & params)Line 179   C++
    libcef.dll!service_manager::Main(service_manager::MainParams & params)Line 218   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 191   C++
    test.exe!CefExecuteProcess(const CefMainArgs & args, scoped_refptr<CefApp> application, void * windows_sandbox_info)Line 193   C++
    test.exe!main(int argc, char * * argv)Line 179   C++


code:
Code: Select all
   HINSTANCE hInstance = GetModuleHandle(NULL);
   CefMainArgs main_args(hInstance);
   int exit_code = CefExecuteProcess(main_args, cb->app.get(), NULL);


all works fine on win7_64bit.

P.S. Why there is also this line "[0627/144955.862:INFO:media_foundation_video_encode_accelerator_win.cc(329)] Windows versions earlier than 8 are not supported." ??
lolovo
Mentor
 
Posts: 67
Joined: Fri Aug 12, 2016 6:11 am

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby magreenblatt » Tue Jun 27, 2017 10:36 am

Your manifest is likely incorrect. See viewtopic.php?f=6&t=14721&start=10
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby lolovo » Tue Jun 27, 2017 1:23 pm

magreenblatt wrote:Your manifest is likely incorrect. See http://magpcss.org/ceforum/viewtopic.ph ... 1&start=10


I used this manifest:
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!--The ID below indicates application support for Windows Vista -->
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
      <!--The ID below indicates application support for Windows 7 -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
      <!--The ID below indicates application support for Windows 8 -->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
      <!--The ID below indicates application support for Windows 8.1 -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
      <!--The ID below indicates application support for Windows 10 -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
    </application>
  </compatibility>
</assembly>


Also tried without win7/8/vista id like described in url you mentioned. Same.
lolovo
Mentor
 
Posts: 67
Joined: Fri Aug 12, 2016 6:11 am

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby lolovo » Tue Jun 27, 2017 2:31 pm

Is it possible to obtain this issue due to slow machine (4gb of ram) & multithreaded mechanism of work? It seems for me that CefExecuteProccess wasn't complete when browserview was tried to create..... ?
lolovo
Mentor
 
Posts: 67
Joined: Fri Aug 12, 2016 6:11 am

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby magreenblatt » Tue Jun 27, 2017 3:14 pm

Does the problem reproduce with the cefclient sample application? Where are you creating the browser?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby lolovo » Wed Jun 28, 2017 4:14 am

problem doesn't reproduce on cefclient/cefsimple...

Initialization is the following in main():
Code: Select all
   int exit_code = CefExecuteProcess(main_args, cb->app.get(), NULL);
   if (exit_code >= 0) {
      return 0;// exit_code;
   }

   CefSettings settings;

   settings.single_process = false;
   settings.command_line_args_disabled = true;
   settings.multi_threaded_message_loop = true;
   settings.no_sandbox = true;
   settings.ignore_certificate_errors = true;
   CefString(&settings.user_data_path) = "";
   CefString(&settings.cache_path) = "";
   settings.persist_session_cookies = false;
   settings.persist_user_preferences = false;

   CefInitialize(main_args, settings, cb->app.get(), NULL);


Right after this initialization several browser windows created in parallel. But I see errors "patched == 0" after (!) creation of browser windows (one error for each window), but according to debugging backtrace of crashed process it happens in CefExecuteProcess in main that already was executed. That why I'm wondering is Cef ready for work right after CefInitialize in multithread mode or I should check ready state somehow before trying create browsers ? Machine really slow and swapfile is used sometimes...

Creation of browser windows happens in TID_UI. For each browser separate handler (SimpleHandler):
Code: Select all
         CefRefPtr<CefBrowserView> browser_view = CefBrowserView::CreateBrowserView(handler, _url, (*it).second.first.second, cx, NULL);
         if (browser_view)
         {
            SimpleWindowDelegate *wnd = new SimpleWindowDelegate(browser_view, ci->hide);
            CefRefPtr<CefWindow> window = CefWindow::CreateTopLevelWindow(wnd);
            if (window)
            {
               *newId = browser_view->GetBrowser()->GetIdentifier();
               *_ret = true;
            }
            else
               delete wnd;
         }
lolovo
Mentor
 
Posts: 67
Joined: Fri Aug 12, 2016 6:11 am

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby magreenblatt » Wed Jun 28, 2017 9:17 am

CEF has multiple processes -- the crash is in the renderer process, not the main process. Try creating the browser from CefBrowserProcessHandler::OnContextInitialized.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby lolovo » Wed Jun 28, 2017 11:19 am

I've put flag into onContextInitialized to know if it initialized... and after this create browsers... result - same error. Btw in win10 I've tested also CEF 3.2987.1601.gf035232_windows32 and there was same error.... but in win7_64bit/win8.1 there is not and all works fine...
lolovo
Mentor
 
Posts: 67
Joined: Fri Aug 12, 2016 6:11 am

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby fddima » Wed Jun 28, 2017 4:45 pm

For me CEF 57, 58 and 59 works perfectly on win 10 x64. I'm suggest to switch from questions which no one can answer without access to your codebase to acquiring symbilized stacks to get idea where issue is happens. Naturally it can be tied to your code or to CEF, but by lack of any specific info, there is impossible to provide specific answers except some generic suggestions which already done.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: CEF crashes during CefExecuteProcess on Win10 64bit

Postby lolovo » Thu Jun 29, 2017 3:23 am

Yes, I understand that it is impossible to point where is the wrong place without seeing a code...but there is one more thing I would like to ask. Initially I took cefsimple code example as start point and adopted it for project. I have in code GUI (comctl32) with its own standard message loop & windowsubclass proc and right now I've tested program with GUI and without.... and without GUI all works fine on Win10 (at least there is no error "patched==0" in CEF 57) but with GUI error occurs... I saw in cefclient code that there is MainMessageLoop and MainMessageLoopMultithreadedWin and there is creation of hidden window for message processing.... but in my case I don't create any messageloop for CEF just pass settings with multithread option in main like in cefsimple example and somewhere in other thread create window & message loop from console application:
Code: Select all
HWND hMainWindow = NULL;
HINSTANCE hiInst = NULL;
...
void UI::InitComCtls()
{
   INITCOMMONCONTROLSEX icce = { 0 };

   icce.dwSize = sizeof(INITCOMMONCONTROLSEX);
   icce.dwICC = ICC_TAB_CLASSES;
   InitCommonControlsEx(&icce);
}

void* CreateUI(LPVOID info)
{
   UI* ui = ((UI*)info);

   GetConsoleTitleA(t, 500);

   HWND hwndConsole = FindWindowA(NULL, t);
   ui->setHwndConsole(hwndConsole);

   HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwndConsole, GWL_HINSTANCE);
   ui->setInstance(hInstance);
   ui->InitComCtls();

   WNDCLASS wc = { 0 };
   wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
   wc.hCursor = LoadCursor(hInstance, IDC_ARROW);
   wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
   wc.hInstance = hInstance;
   wc.lpfnWndProc = &ui->WndProc;
   wc.lpszClassName = TEXT("GUI");
   wc.style = CS_HREDRAW | CS_VREDRAW;
   
   if (!RegisterClass(&wc))
   {
      std::cout << "Problem with your WNDCLASS, foo." << std::endl;
      return 0; 
   }

   HWND hwndWindow = CreateWindowEx(0,
      TEXT("GUI"),
      TEXT("GUI"),
      WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
      CW_USEDEFAULT, CW_USEDEFAULT, 1240, 480,
      HWND_DESKTOP,
      NULL,
      hInstance, ui);

   ui->setHwndWindow(hwndWindow);

   hiInst = hInstance;
   hMainWindow = hwndWindow;
   
   ui->DrawAll();

   ShowWindow(hwndWindow, SW_SHOWNORMAL);
   UpdateWindow(hwndWindow);

   MSG msg;
   while (GetMessage(&msg, hwndWindow, 0, 0))
   {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
   }
   return 0;
}
void UI::CreateList1()
{
...
   hList1 = CreateWindowEx(
      LVS_EX_SUBITEMIMAGES | LVS_EX_DOUBLEBUFFER,         
      WC_LISTVIEW,   
      L"",   
      WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT | LVS_ICON | LVS_SHAREIMAGELISTS, 
      0,         
      tr.bottom,       
      rc.right-rc.left,     
      rc.bottom-rc.top-tr.bottom-(rc2.bottom-rc2.top),       
      hMainWindow,   
      NULL,     
      hiInst,   
      this     
   );
   SetWindowSubclass(hList1, &this->subClassProc, 0, (DWORD_PTR)this);
...
}
LRESULT CALLBACK UI::subClassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
   UI* pThis = reinterpret_cast<UI*>(dwRefData);

   if ((uMsg == WM_COMMAND) && (HIWORD(wParam) == BN_CLICKED))
   {
      if (processCommands(pThis,hWnd, wParam)) return true;
   }

   return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
LRESULT CALLBACK UI::WndProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
   UI* pThis = 0;

   if(message == WM_NCCREATE)
   {
      pThis = static_cast<UI*>(reinterpret_cast<CREATESTRUCT*>(lparam)->lpCreateParams);
      SetLastError(0);
      if (!SetWindowLongPtr(hwnd, GWL_USERDATA, reinterpret_cast<LONG_PTR>(pThis)))
      {
         if (GetLastError() != 0)
            return FALSE;
      }
   }
   else
   {
      pThis = reinterpret_cast<UI*>(GetWindowLongPtr(hwnd, GWL_USERDATA));
   }
...
}


and as I wrote above there is code in main():
Code: Select all
int main(int argc, char** argv)
{
   CefEnableHighDPISupport();

   ChromeBrowser CB;
   cb = &CB;

   signal(SIGINT, exitHandler);
   signal(SIGTERM, exitHandler);
   signal(SIGBREAK, exitHandler);

   HINSTANCE hInstance = GetModuleHandle(NULL);

   CefMainArgs main_args(hInstance);

   int exit_code = CefExecuteProcess(main_args, cb->app.get(), NULL);
   if (exit_code >= 0) {
      return 0;// exit_code;
   }

   CefSettings settings;

   settings.single_process = false;
   settings.command_line_args_disabled = true;
   settings.multi_threaded_message_loop = true;
   settings.no_sandbox = true;
   settings.ignore_certificate_errors = true;
   CefString(&settings.user_data_path) = "";
   CefString(&settings.cache_path) = "";
   settings.persist_session_cookies = false;
   settings.persist_user_preferences = false;

   CefInitialize(main_args, settings, cb->app.get(), NULL);

   MainLoop ml(cb);
   ml.loop(); // this is while() that check every second if there is a job to do open browser and so on...
}


I wonder should I create MessageLoop like in cefclient and hidden window for message processing and may be smth other for apropriate work with windows messages especially ?
lolovo
Mentor
 
Posts: 67
Joined: Fri Aug 12, 2016 6:11 am

Next

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 49 guests