CefExecuteProcess fails with hash check CEF_API_HASH_PLATFO

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.

CefExecuteProcess fails with hash check CEF_API_HASH_PLATFO

Postby miro » Tue Oct 31, 2023 5:21 am

Hi
when start our application we load cef etc. but the cef process cant be created and fails in function "CefExecuteProcess " in file "libcef_dll_wrapper.cc" in line 69:

Code: Select all
CEF_GLOBAL int CefExecuteProcess(const CefMainArgs& args,
                                 CefRefPtr<CefApp> application,
                                 void* windows_sandbox_info) {
  const char* api_hash = cef_api_hash(0);
  if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) { // <-- hash value
    // The libcef API hash does not match the current header API hash.
    DCHECK(false); // <-- check failed
    return 0;
  }


What can cause that our hash value is not set properly, i have nothing in the log files about build errors etc and we never had this issue before.
Where is the CEF_API_HASH_PLATFORM value set, is the download maybe not successfull or the build process?

Thanks
Miro
miro
Techie
 
Posts: 31
Joined: Wed Oct 14, 2020 5:48 am

Re: CefExecuteProcess fails with hash check CEF_API_HASH_PL

Postby magreenblatt » Tue Oct 31, 2023 10:21 am

You likely have a mismatch between libcef.dll version and libcef_dll_wrapper build.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CefExecuteProcess fails with hash check CEF_API_HASH_PL

Postby miro » Fri Nov 10, 2023 10:46 am

Hello,
I would like to confirm that you are right and the versions were not the same, I had other earlier version of the DLL but now after rebuild the CEF and ensuring that the same DLL's are used everywhere this check problem doesnt occur anymore
and CefExecuteProcess doesnt fail anymore.

But few lines later i have a new problem with CefInitialize(...), in file cef_scoped_refptr.h:
Branch 5993, OS Win10 64bit, all this works previous before update to this new branch.
Code: Select all

m_cefApp = new ClientApp();
// arguments
CefMainArgs main_args(GetModuleHandle(nullptr));
void* sandbox_info = nullptr;
// values for settings are also set
m_bInitialized = CefInitialize(main_args, settings, m_cefApp.get(), sandbox_info);
// Failed in file cef_scoped_refptr.h in this lines:
// static
template <typename T>
void scoped_refptr<T>::Release(T* ptr) {
  ptr->Release();
}


It would be great help if someone can help to continue to use CEF.
Thanks for any help
miro
miro
Techie
 
Posts: 31
Joined: Wed Oct 14, 2020 5:48 am

Re: CefExecuteProcess fails with hash check CEF_API_HASH_PL

Postby magreenblatt » Fri Nov 10, 2023 11:08 am

How type is the |m_cefApp| variable? It should be a CefRefPtr<>.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CefExecuteProcess fails with hash check CEF_API_HASH_PL

Postby miro » Mon Nov 13, 2023 9:07 am

Hi,
yes its exactly like your hint:
ClientApp is derived from CefApp and defined like this:
CefRefPtr<ClientApp>m_cefApp;
Here bit more from callstack:
Code: Select all
// From the file: cef_scoped_refptr.h line 266:
  ~scoped_refptr() {
    static_assert(!base::cef_subtle::IsRefCountPreferenceOverridden(
                      static_cast<T*>(nullptr), static_cast<T*>(nullptr)),
                  "It's unsafe to override the ref count preference."
                  " Please remove REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE"
                  " from subclasses.");
    if (ptr_) {
      Release(ptr_);
    }
  }

and same file:
Code: Select all
// From the file: cef_scoped_refptr.h line 365:
// static
template <typename T>
void scoped_refptr<T>::Release(T* ptr) {
  ptr->Release(); // <-- line where the crash occurs
}


Did someone have also this issues, or know how to fix this? This is code which never make any problems before.

Thanks for any help
miro
miro
Techie
 
Posts: 31
Joined: Wed Oct 14, 2020 5:48 am

Re: CefExecuteProcess fails with hash check CEF_API_HASH_PL

Postby ndesktop » Mon Nov 13, 2023 10:16 am

Not sure how your code looks, but I derive my ClientApp class from CefApp, but stored as CefRefPtr<CefApp>, not CefRefPtr<ClientApp>.
Code: Select all
CefRefPtr<CefApp> app = new ClientApp;

Also, TheApp class does have refcounting:
Code: Select all
IMPLEMENT_REFCOUNTING(ClientApp);


Maybe is one of those two giving you trouble? It sounds like a combination of ClientApp::AddRef and CefApp::Release or something like that.
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: CefExecuteProcess fails with hash check CEF_API_HASH_PL

Postby miro » Wed Nov 22, 2023 11:14 am

Hello
@ndesktop thanks for your suggestion, i change it like your example but the issue is the same, no diff.
Sorry i could not answer earlier.
CefInitialize always return 0 and the crash is on the same code line like in my previous post.
// From the file: cef_scoped_refptr.h line 365:
// static
template <typename T>
void scoped_refptr<T>::Release(T* ptr) {
ptr->Release(); // <-- line where the crash occurs
}

Just to mention that our implementation works well since 2018 without significant issues,
so im somehow sure that our last steps which is creating distribution and following with cmke creating binaries is something broken in our scripts, i will check that now first before and test again.

regards
miro
miro
Techie
 
Posts: 31
Joined: Wed Oct 14, 2020 5:48 am


Return to Support Forum

Who is online

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