CefInitialize crashing on MacOS

Having problems with building or using the JCEF Java binding? Ask your questions here.

CefInitialize crashing on MacOS

Postby LorenzoDV » Tue Jan 01, 2019 5:14 pm

Hi,

after many days of struggling, I succeeded in running JCEF without a bundle on OSX in an application that uses SWT.

Running without a bundle (the magic .app directory) required some patches to CEF and JCEF.

Using SWT was tricky because it has its own event loop on thread 0. Luckily, SWT also includes native Cocoa events in its loop, so I only had to be careful not to cause deadlocks by calling CEF from threads other than the main one.

Now the (hopefully last) problem is integrating into a full Eclipse run. Since Eclipse is SWT based, I expected my proof-of-concept SWT program to work, but it does not. :(

The code is just opening an SWT Shell with a CefBrowser inside (using the AWT-SWT bridging capabilities of SWT).
When N_Initialize is called, the entire process crashes with a fatal error.

Code: Select all
[0101/225434.203028:FATAL:malloc_zone_functions_mac.cc(27)] Check failed: functions->malloc && functions->calloc && functions->valloc && functions->free && functions->realloc && functions->size.
0   Chromium Embedded Framework         0x0000000130e935bc base::debug::StackTrace::StackTrace(unsigned long) + 28
1   Chromium Embedded Framework         0x0000000130df575f logging::LogMessage::~LogMessage() + 223
2   Chromium Embedded Framework         0x0000000130ddf404 base::allocator::StoreZoneFunctions(_ChromeMallocZone const*, base::allocator::MallocZoneFunctions*) + 228
3   Chromium Embedded Framework         0x0000000130ddf4f0 base::allocator::StoreMallocZone(_ChromeMallocZone*) + 160
4   Chromium Embedded Framework         0x0000000130dde72d base::allocator::StoreFunctionsForAllZones() + 77
5   Chromium Embedded Framework         0x0000000130e9d55d base::allocator::InitializeAllocatorShim() + 13
6   Chromium Embedded Framework         0x000000013236e6f5 service_manager::MainInitialize(service_manager::MainParams&) + 69
7   Chromium Embedded Framework         0x0000000130b18624 CefContext::Initialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, scoped_refptr<CefApp>, void*) + 580
8   Chromium Embedded Framework         0x0000000130b1839c CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, scoped_refptr<CefApp>, void*) + 252
9   Chromium Embedded Framework         0x000000012ec02694 cef_initialize + 276
10  libjcef.dylib                       0x0000000129473192 CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, scoped_refptr<CefApp>, void*) + 146
11  libjcef.dylib                       0x0000000129437c79 +[CefHandler initialize:] + 137
12  Foundation                          0x00007fffbb3ce52a __NSThreadPerformPerform + 326
13  CoreFoundation                      0x00007fffb996e3e1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14  CoreFoundation                      0x00007fffb994f65c __CFRunLoopDoSources0 + 556
15  CoreFoundation                      0x00007fffb994eb46 __CFRunLoopRun + 934
16  CoreFoundation                      0x00007fffb994e544 CFRunLoopRunSpecific + 420
17  Foundation                          0x00007fffbb37f252 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
18  libswt-pi-cocoa-4628.jnilib         0x0000000123551329 Java_org_eclipse_swt_internal_cocoa_OS_objc_1msgSend_1bool__JJJJ + 57
19  ???                                 0x000000010cf9a268 0x0 + 4512653928


The strange thing is that the same Shell with a CefBrowser works in a "small" Java program with just a main method that launches the Shell and then spins the SWT message loop.

I looked into the Chromium source and found that in allocator_interceptor_mac.mm it is attempting to install an interceptor for malloc-related functions. Further down in malloc_zone_functions_mac.cc some of the pointers to the original functions are found to be NULL and that is the cause of the crash.

This is as far as I can get :(
What could be the cause? Is something else corrupting the memory?
Any help would be greatly appreciated!

Thanks.
LorenzoDV
Newbie
 
Posts: 8
Joined: Sat Dec 08, 2018 4:41 pm

Re: CefInitialize crashing on MacOS

Postby magreenblatt » Wed Jan 02, 2019 4:21 am

I would suggest checking the Eclipse native code. Perhaps Eclipse is also trying to redirect malloc functions.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

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