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.