v8_context_snapshot.bin not being loaded

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.

v8_context_snapshot.bin not being loaded

Postby IvanPong1 » Thu Aug 20, 2020 11:04 pm

Hi all,

I'm using an older, stable version of cef:
3.3578.1863.gbf8cff

I'm initializing cef with a class implementing:
Code: Select all
   public CefApp,
   public CefBrowserProcessHandler,
   public CefRenderProcessHandler


My initialization looks like:

Code: Select all
   CefSettings setting;

   //CefString(&(setting.browser_subprocess_path)).FromString(_tempnam("b1", "b2"));
   CefString(&(setting.cache_path)).FromString(_tempnam("b3", "b4"));
   setting.windowless_rendering_enabled = true;
   setting.multi_threaded_message_loop = true;

   CefInitialize(main_args, setting, this, nullptr);


the exe and all other bin/dat/dll files are in one folder, to allow cef to find them. On calling CefInitialize, I get the following callstack:
Code: Select all
    ntdll.dll!00007ff992ddb042()   Unknown
    ntdll.dll!00007ff992de390e()   Unknown
    ntdll.dll!00007ff992de3c1a()   Unknown
    ntdll.dll!00007ff992d7ecb1()   Unknown
    ntdll.dll!00007ff992cf174c()   Unknown
    ntdll.dll!00007ff992ceda21()   Unknown
    ntdll.dll!00007ff992ceb52a()   Unknown
    ntdll.dll!00007ff992ce9efd()   Unknown
    KernelBase.dll!00007ff98f73e9b7()   Unknown
    KernelBase.dll!00007ff98f73e8a6()   Unknown
    libcef.dll!base::File::DoInitialize(const base::FilePath & path, unsigned int flags) Line 394   C++
    libcef.dll!base::File::Initialize(const base::FilePath & path, unsigned int flags) Line 95   C++
    libcef.dll!gin::`anonymous namespace'::OpenV8File(const char * file_name, base::MemoryMappedFile::Region * region_out) Line 158   C++
>   libcef.dll!gin::V8Initializer::LoadV8Snapshot(gin::V8Initializer::V8SnapshotFileType snapshot_file_type) Line 282   C++
    libcef.dll!content::ContentMainRunnerImpl::Initialize(const content::ContentMainParams & params) Line 760   C++
    libcef.dll!service_manager::MainInitialize(service_manager::MainParams & params) Line 425   C++
    libcef.dll!CefContext::Initialize(const CefMainArgs & args, const CefStructBase<CefSettingsTraits> & settings, scoped_refptr<CefApp> application, void * windows_sandbox_info) Line 407   C++
    libcef.dll!CefInitialize(const CefMainArgs & args, const CefStructBase<CefSettingsTraits> & settings, scoped_refptr<CefApp> application, void * windows_sandbox_info) Line 250   C++
    libcef.dll!cef_initialize(const _cef_main_args_t * args, const _cef_settings_t * settings, _cef_app_t * application, void * windows_sandbox_info) Line 228   C++
    VPHTML.dll!CefInitialize(const CefMainArgs & args, const CefStructBase<CefSettingsTraits> & settings, scoped_refptr<CefApp> application, void * windows_sandbox_info) Line 226   C++
    VPHTML.dll!Frame::Frame() Line 21   C++
    VPHTML.dll!VPHTML::{ctor}::__l2::<lambda>() Line 83   C++
    VPHTML.dll!std::_Invoker_functor::_Call<void <lambda>(void) >(VPHTML::{ctor}::__l2::void <lambda>(void) && _Obj) Line 1447   C++
    VPHTML.dll!std::invoke<void <lambda>(void) >(VPHTML::{ctor}::__l2::void <lambda>(void) && _Obj) Line 1447   C++
    VPHTML.dll!std::thread::_Invoke<std::tuple<void <lambda>(void) >,0>(void * _RawVals) Line 39   C++
    ucrtbase.dll!00007ff98fbd1ffa()   Unknown
    kernel32.dll!00007ff990d87974()   Unknown
    ntdll.dll!00007ff992d4a271()   Unknown


The line:
Code: Select all
  file_.Set(CreateFile(path.value().c_str(), access, sharing, NULL,
                       disposition, create_flags, NULL));

in file_win.cc

fails, as file_ is null. This is the line that requests v8_...bin.
There's an error thrown, and the heap is blown. Why is this? And how do I fix it?


I am not able to upgrade my version of cef unfortunately, but this version works with the CefSharp project, so i know that there is a way to initialize things so that file_ is not null

Any help?
IvanPong1
Techie
 
Posts: 13
Joined: Thu Aug 20, 2020 10:55 pm

Re: v8_context_snapshot.bin not being loaded

Postby magreenblatt » Fri Aug 21, 2020 10:15 am

It looks like you’re using browser_subprocess_path incorrectly. It needs to be the full path to an exe. See the docs.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: v8_context_snapshot.bin not being loaded

Postby IvanPong1 » Fri Aug 21, 2020 11:52 am

Thanks for the reply, what does that mean exactly? I've seen references to it, but there's no exe built when compiling cef. Does it have to be set to the path of a particular exe? I've tried not setting it too, and that didn't work.

If there's a document somewhere on how that works, that would be great too.

Thanks.
IvanPong1
Techie
 
Posts: 13
Joined: Thu Aug 20, 2020 10:55 pm

Re: v8_context_snapshot.bin not being loaded

Postby magreenblatt » Fri Aug 21, 2020 12:08 pm

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

Re: v8_context_snapshot.bin not being loaded

Postby IvanPong1 » Mon Aug 24, 2020 4:38 pm

Thanks! That appeared to fix it. One more question then.

I implemented CefRenderHandler, and defined and declared:
Code: Select all
void GetViewRect(CefRefPtr<CefBrowser> /*browser*/, CefRect& rect) override;
void OnPaint(
   CefRefPtr<CefBrowser> browser,
   PaintElementType type,
   const RectList& dirtyRects,
   const void* buffer,
   int width,
   int height) override;



GetViewRectis being entered after sending HTML in to the browser, but OnPaint is never called. What could be calling this? One recommendation I saw suggested that I call WasResized after creating the browser, so I tried that, but it didn't work. Thanks for your help.
IvanPong1
Techie
 
Posts: 13
Joined: Thu Aug 20, 2020 10:55 pm

Re: v8_context_snapshot.bin not being loaded

Postby magreenblatt » Mon Aug 24, 2020 4:51 pm

Did you set CefSettings.windowless_rendering_enabled? Are you returning a non-empty rect?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: v8_context_snapshot.bin not being loaded

Postby IvanPong1 » Tue Aug 25, 2020 8:53 am

>Did you set CefSettings.windowless_rendering_enabled?
Yes, I set it to true.

>Are you returning a non-empty rect?
Yes, I have:
Code: Select all
   void GetViewRect(CefRefPtr<CefBrowser> /*browser*/, CefRect& rect) override
   {
      rect.Set(0, 0, Width, Height);
   }


Where Width and Height are 100

Edit:

There are some details I should add.

The debug build of the dll doesn't work. It complains about the OS version it's running on. It appears I need a manifest file of some type to fix this. However, it does work in release.

I have one dll: VPHTML.dll. This plugs into another project via dynamic linking. To test it, I have two projects. One is a minimalist console application. This calls the initialize for my dll, then it sleeps for 3seconds, next it enters a while loop for some other functionality I have. The second application is the intended application. To make the cases as similar as possible, I have it do the exact same thing as the console application, after initialization. Then it goes and does the stuff it usually does.

In the console application, I see both GetViewRect and OnPain called. I've been verifying this with breakpoints.
In the application I'm aiming for, I see GetViewRect called, but not OnPaint. Again verified with breakpoints.

In the targeted application, the VPHTML.dll is fed the HINSTANCE with GetModuleHandle(NULL) from an auxilary dll, while in the console application, it is directly from the exe - I don't think there should be any difference.

Additionally, in the console application, I left the
Code: Select all
std::cout << "Hello World!";

statement in. This is printing out to the console multiple times, despite having only one call. This is bad, though there are no errors associated with it, and it isn't my targeted application. Nothing of this sort happens in the targeted application.

Finally, The only error being logged in the debug.log file is
Lost UI shared context.
I have however turned GPU rendering off, and have verified that OnAcceleratedPaint is not being called if I attempt to implement it.

This version of the dll is also verified as working. CefSharp can pick the dll up and use it without any trouble, so it's a problem with how I'm setting it up.

Again, thanks for your help!
IvanPong1
Techie
 
Posts: 13
Joined: Thu Aug 20, 2020 10:55 pm

Re: v8_context_snapshot.bin not being loaded

Postby IvanPong1 » Mon Aug 31, 2020 10:19 am

Any help?
IvanPong1
Techie
 
Posts: 13
Joined: Thu Aug 20, 2020 10:55 pm

Re: v8_context_snapshot.bin not being loaded

Postby magreenblatt » Mon Aug 31, 2020 11:09 am

The debug build of the dll doesn't work. It complains about the OS version it's running on. It appears I need a manifest file of some type to fix this.

The CEF distribution includes manifest files that you can use with your application.

In the console application, I see both GetViewRect and OnPain called. I've been verifying this with breakpoints.
In the application I'm aiming for, I see GetViewRect called, but not OnPaint. Again verified with breakpoints.

Are the sub-processes (with the --type command-line flag) launching correctly in your application? For example, do you see them in Process Explorer?

You can also try running with verbose logging.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 94 guests