Crash in CefBrowser::GetMainFrame
Posted: Wed Sep 08, 2021 1:09 pm
I recently upgraded from build 4324 to 4606 (osx 10.15.7, xcode 12.4). I'm now experiencing frequent crashes in CefBrowser::GetMainFrame. cef_browser.h does not indicate that GetMainFrame can only be called from certain threads (I'm calling it from the browser process). The specific crash is inside NotificationStateLock, a CHECK fail at browser_info.cc:457. I did find this previous forum thread about this issue: viewtopic.php?f=6&t=18564 The suggestion in that thread was to make sure GetMainFrame isn't being called during loading. I have confirmed that is not the case here. My crashing thread looks like this:
Meanwhile the main thread is also calling GetMainFrame:
So a few questions: Should it be okay to call GetMainFrame from threads other than the UI thread? Should it be thread-safe (so it can be called from multiple threads without synchronization)? I would expect from what I know of the docs that both those answers are yes and this is a bug...
- Code: Select all
Thread 33 Crashed:
0 org.cef.framework 0x000000010946dcee CefBrowserInfo::NotificationStateLock::NotificationStateLock(CefBrowserInfo*) + 254 (browser_info.cc:457)
1 org.cef.framework 0x000000010946d19d CefBrowserInfo::GetMainFrame() + 61 (browser_info.cc:212)
2 org.cef.framework 0x0000000105c7a6ee (anonymous namespace)::browser_get_main_frame(_cef_browser_t*) + 62 (browser_cpptoc.cc:253)
3 XXXXXXXXXXXXXXX 0x0000000105b5042d CefBrowserCToCpp::GetMainFrame() + 45 (browser_ctocpp.cc:252)
Meanwhile the main thread is also calling GetMainFrame:
- Code: Select all
Thread 0:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff70953062 __psynch_mutexwait + 10
1 libsystem_pthread.dylib 0x00007fff70a11917 _pthread_mutex_firstfit_lock_wait + 83
2 libsystem_pthread.dylib 0x00007fff70a0f937 _pthread_mutex_firstfit_lock_slow + 222
3 org.cef.framework 0x00000001098499c6 base::internal::LockImpl::LockInternalWithTracking() + 70 (lock_impl_posix.cc:86)
4 org.cef.framework 0x000000010946df7b CefBrowserInfo::NotificationStateLock::~NotificationStateLock() + 651 (browser_info.cc:472)
5 org.cef.framework 0x000000010946d1c8 CefBrowserInfo::GetMainFrame() + 104 (browser_info.cc:217)
6 org.cef.framework 0x0000000105c7a6ee (anonymous namespace)::browser_get_main_frame(_cef_browser_t*) + 62 (browser_cpptoc.cc:253)
7 XXXXXXXXXXXXXXX 0x0000000105b5042d CefBrowserCToCpp::GetMainFrame() + 45 (browser_ctocpp.cc:252)
So a few questions: Should it be okay to call GetMainFrame from threads other than the UI thread? Should it be thread-safe (so it can be called from multiple threads without synchronization)? I would expect from what I know of the docs that both those answers are yes and this is a bug...