Sporadic crash in when doing CefInitialize(...)

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.

Sporadic crash in when doing CefInitialize(...)

Postby clown » Mon Sep 11, 2023 5:32 am

Hello,

I'm facing with strange issue which is hard to troubleshoot. Time-to-time my application that uses Cef crashes when performing initialization. I have a crash bump collected and was a analyzing the code till the time when it went to source files that are not available in public.

A few notes ahead:
1. cef version: 106.0.26
2. I use separate process for cef helper processes

Upon starting my application initializes the cef_app:
Code: Select all
    ...
    void* sandboxInfo = nullptr;
    CefMainArgs args(GetModuleHandle(nullptr));
    CefInitialize(args, *settings, app, sandboxInfo);
    ...


below is how I construct settings:
Code: Select all
   using namespace std::literals::string_view_literals;

   auto settings = std::make_unique<CefSettings>();

   auto constexpr CACHE = "cache"sv;
   auto constexpr DATA = "data"sv;
   auto constexpr AGENT_USERS = "agent/Users"sv;
   auto constexpr DEBUG_FILE = "debug.log"sv;

   char username[UNLEN + 1];
   DWORD len = UNLEN + 1;
   GetUserName(username, &len);

   CefString(&settings->cache_path)
       .FromWString((dataPath() / AGENT_USERS / username / CACHE).native());
   CefString(&settings->user_data_path)
       .FromWString((dataPath() / AGENT_USERS / username / DATA).native());
   CefString(&settings->log_file)
       .FromWString((dataPath() / AGENT_USERS / username / CACHE / DEBUG_FILE).native());

   settings->no_sandbox = true;
   settings->multi_threaded_message_loop = true;

   constexpr auto HELPER_EXECUTABLE{"cef_helper.exe"sv};
   const auto executablePath = binDirPath / HELPER_EXECUTABLE;
   CefString(&settings->browser_subprocess_path).FromWString(executablePath.wstring());


In most cases everything works as expected, my applicaiton starts, helper processes starts as well, once I navigate to some url, I see that url. However, time-to-time the initialization fails. Below is a callstack from the dump:

000000f0`24afe8a0 00007ffa`1c383dbd : aaaaaaaa`aaaaaaaa 00007ffa`23440b98 00000000`00000000 000002db`00294280 : libcef!base::i18n::InitializeICU+0x346
000000f0`24afed70 00007ffa`1c382f52 : 000002b7`021c1b90 000000f0`00000013 000002b7`021af260 00007ffa`1c48e889 : libcef!content::ContentMainRunnerImpl::Initialize+0x30d
000000f0`24afee90 00007ffa`1919ad63 : 000002db`002600f0 00007ffa`245e41aa 00000000`00000008 00007ffa`21d5f048 : libcef!content::ContentMainInitialize+0x4b3
000000f0`24aff110 00007ffa`1919aafe : 000002db`0026c1d0 00007ffa`245e35b1 000002db`00294100 00007ffa`1c417bae : libcef!CefMainRunner::ContentMainInitialize+0x10d
000000f0`24aff1e0 00007ffa`19172b0e : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : libcef!CefMainRunner::Initialize+0xb4
000000f0`24aff260 00007ffa`19172771 : 000002b7`02172898 000002b7`021a1a70 000000f0`24aff440 00007ffa`190e120b : libcef!CefContext::Initialize+0x368
000000f0`24aff3c0 00007ffa`190e12dc : 000002b7`021c0000 00000000`00000000 00000000`00000000 000002b7`020d1560 : libcef!CefInitialize+0x130
000000f0`24aff420 00007ffa`245d1fd5 : 000000f0`24aff6e0 00007ffa`245ae26d ffffffff`ffffffff 00000000`00000000 : libcef!cef_initialize+0xbc
000000f0`24aff660 00007ffa`2459382b : 000002b7`021afbf0 000000f0`24aff7a0 000002b7`021afbf0 00000000`00000079 : my_app!CefInitialize+0xa5


Given pdbs and source code available I was able to get to the place:
[0xe] libcef!CefMainRunner::ContentMainInitialize+0x10d [Y:\work\CEF3_git\chromium\src\cef\libcef\browser\main_runner.cc @ 378] 0xf024aff110 0x7ffa1919aafe

which points to this line:
Code: Select all
  return content::ContentMainInitialize(std::move(main_params),
                                        main_runner_.get());


was not able to go further.

Maybe somebody else was facing with something similar or can suggest something.
Thanks.
clown
Newbie
 
Posts: 6
Joined: Mon Sep 11, 2023 5:07 am

Re: Sporadic crash in when doing CefInitialize(...)

Postby ndesktop » Mon Sep 11, 2023 9:27 am

InitializeICU indicates some error related to icudtl.dat. Try to run using --single-process or from WinDBG with child subprocesses (or modify the sources, setup an exception handler and when InitializeICU bonks, invoke a debugger, assert etc. when the exception occurs to catch it live).
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: Sporadic crash in when doing CefInitialize(...)

Postby clown » Tue Sep 12, 2023 6:52 am

Thank you for the reply, but I'm not sure I following your suggestion.

if it crashed in same place I still won't be able to see why as I don't have a source for
libcef!base::i18n::InitializeICU+0x346
, it is located in the file:
icu_util.cc


some more date from dump:
STACK_COMMAND: ~0s; .ecxr ; kb

FAULTING_SOURCE_LINE: Y:\work\CEF3_git\chromium\src\base\i18n\icu_util.cc

FAULTING_SOURCE_FILE: Y:\work\CEF3_git\chromium\src\base\i18n\icu_util.cc

FAULTING_SOURCE_LINE_NUMBER: 540

FAULTING_SOURCE_CODE:
No source found for 'Y:\work\CEF3_git\chromium\src\base\i18n\icu_util.cc'


SYMBOL_NAME: libcef!base::i18n::InitializeICU+346

MODULE_NAME: libcef

IMAGE_NAME: libcef.dll

FAILURE_BUCKET_ID: BREAKPOINT_80000003_libcef.dll!base::i18n::InitializeICU

OS_VERSION: 10.0.19041.1

BUILDLAB_STR: vb_release

OSPLATFORM_TYPE: x64

OSNAME: Windows 10

IMAGE_VERSION: 106.0.26.0

FAILURE_ID_HASH: {64835cd0-0a09-7dc0-02a7-fcd8e1c59d92}


so most likely I'll get the the same dump file, or even during real debugging, I still won't be able to see what is happening in the icu_util.cc file :(
clown
Newbie
 
Posts: 6
Joined: Mon Sep 11, 2023 5:07 am

Re: Sporadic crash in when doing CefInitialize(...)

Postby magreenblatt » Tue Sep 12, 2023 9:53 am

magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Sporadic crash in when doing CefInitialize(...)

Postby ndesktop » Tue Sep 12, 2023 12:33 pm

The crash is a breakpoint: BREAKPOINT_80000003
Most likely you are hitting a CHECK (or DCHECK). Around line 540 in icu_util.cc is InitializeICUFromDataFile or DoCommonInitialization.

I think this can be reproduced also with --single-process; run your app with --single-process and wait for the breakpoint to occur.
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: Sporadic crash in when doing CefInitialize(...)

Postby clown » Thu Sep 14, 2023 4:40 am

Thank you for the link, @magreenblatt
and @ndesktop thank you for more details, I'll try cmd parameter you suggested.
clown
Newbie
 
Posts: 6
Joined: Mon Sep 11, 2023 5:07 am


Return to Support Forum

Who is online

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