Page 1 of 1

OSR Integration w/ JavaFX application crashing on Linux

PostPosted: Wed Aug 17, 2022 1:53 pm
by cwhite1022
Hello, I'm struggling to figure out why this integration is crashing on Linux (but works on Windows).
We have an existing JavaFX application and are trying to integrate OSR using CEF C++ (note we use JNI directly and are not using JCEF).

We are only interested in receiving browser frames via OnPaint, there's no GUI for the Browser itself.

However, the application crashes randomly, typically within seconds of starting the CEF browser. It appears as though there's some conflict with the GUI layers (GTK?) as user interaction with the JavaFX UI is almost a guaranteed crash.

Am I missing some configuration for CEF/Chromium to decouple it properly from the GUI layer(s)? Ultimately, this needs to run in a headless environment, but getting it working within the JavaFX application is important.

Can anyone explain the dependence of Chromium/CEF on the GUI layers on Linux (in OSR mode), and is there a way to eliminate or manage such interaction?
Do I need to initialize CEF on a specific (gui related) thread? The CreateBrowser() function seems to indicate it can be called on any thread. Crashing occurs even if OnPaint() callback is a no-op.

Env..
Ubuntu 18.04 (VirtualBox VM)
CEF 103

settings.windowless_rendering_enabled = true;
settings.multi_threaded_message_loop = true;
settings.browser_subprocess_path = <path to cefclient>

gdb of the seg faulted thread (from the core dump) is always useless despite all other threads showing symbols. eg..
(gdb) bt
#0 0x00007fb3c0a9cbd5 in ()
#1 0x00000000c4ae2f48 in ()
#2 0x0000000000000000 in ()

Re: OSR Integration w/ JavaFX application crashing on Linux

PostPosted: Wed Aug 17, 2022 3:06 pm
by magreenblatt
How are you running the application? Are you using xvfb-run or similar?

Re: OSR Integration w/ JavaFX application crashing on Linux

PostPosted: Wed Aug 17, 2022 5:55 pm
by cwhite1022
magreenblatt wrote:How are you running the application? Are you using xvfb-run or similar?


I am simply running 'java' in a Terminal. (OpenJDK 17 to be specific)

Standard Ubuntu 18.04 desktop distribution (Gnome)

Re: OSR Integration w/ JavaFX application crashing on Linux

PostPosted: Wed Aug 17, 2022 8:47 pm
by magreenblatt
You should try using xvfb-run. Search the forum for examples.

Re: OSR Integration w/ JavaFX application crashing on Linux

PostPosted: Thu Aug 18, 2022 11:48 am
by cwhite1022
xvfb-run may become useful when we go to headless production, but for now, I'm actually trying to run a GUI based JavaFX application.

Some further info... I don't even need to create a Browser for it to crash.
Simply calling CEFInitialize() will destabilize the application such that it will crash shortly after (if I touch the UI).

Here's a section of the console logs if it helps identify anything...

Code: Select all
08-18 12:42:15 INFO CEFInitAndShutdownMgr [JavaFX Application Thread]: Initializing Chromium Embedded Framework...
08-18 12:42:15 INFO KayakNativePluginLibraryHandler [JavaFX Application Thread]: Loading: /var/opt/KayakSDK/Plugins/com.imaginecommunications.ChromiumEmbeddedFramework/bin/Linux_x64/libvulkan.so.1
08-18 12:42:15 INFO KayakNativePluginLibraryHandler [JavaFX Application Thread]: Loading: /var/opt/KayakSDK/Plugins/com.imaginecommunications.ChromiumEmbeddedFramework/bin/Linux_x64/libvk_swiftshader.so
08-18 12:42:15 INFO KayakNativePluginLibraryHandler [JavaFX Application Thread]: Loading: /var/opt/KayakSDK/Plugins/com.imaginecommunications.ChromiumEmbeddedFramework/bin/Linux_x64/libGLESv2.so
08-18 12:42:15 INFO KayakNativePluginLibraryHandler [JavaFX Application Thread]: Loading: /var/opt/KayakSDK/Plugins/com.imaginecommunications.ChromiumEmbeddedFramework/bin/Linux_x64/libEGL.so
08-18 12:42:15 INFO KayakNativePluginLibraryHandler [JavaFX Application Thread]: Loading: /var/opt/KayakSDK/Plugins/com.imaginecommunications.ChromiumEmbeddedFramework/bin/Linux_x64/libcef.so
08-18 12:42:15 INFO KayakNativePluginLibraryHandler [JavaFX Application Thread]: Loading: /var/opt/KayakSDK/Plugins/com.imaginecommunications.ChromiumEmbeddedFramework/bin/Linux_x64/libChromiumEmbeddedFrameworkNative.so
08-18 12:42:15 INFO CEFInitAndShutdownMgr [JavaFX Application Thread]: CEF Message Loop setting: Multi-threaded
08-18 12:42:15 INFO CEFInitAndShutdownMgr [CEFInitAndShutdown-1]: Init thread tid=17673
[0818/124215.633188:VERBOSE1:cdm_registration.cc(185)] Registering component updated Widevine 4.10.2449.0
[0818/124215.633489:INFO:cpu_info.cc(53)] Available number of cores: 10
[0818/124215.633520:VERBOSE1:zygote_main_linux.cc(218)] ZygoteMain: initializing 0 fork delegates
[0818/124215.649229:VERBOSE1:cdm_registration.cc(185)] Registering component updated Widevine 4.10.2449.0
[0818/124215.649633:INFO:cpu_info.cc(53)] Available number of cores: 10
[0818/124215.649663:VERBOSE1:zygote_main_linux.cc(218)] ZygoteMain: initializing 0 fork delegates
[0818/124215.660055:VERBOSE1:proxy_config_service_linux.cc(504)] All gsettings tests OK. Will get proxy config from gsettings.
[0818/124215.660202:VERBOSE1:proxy_config_service_linux.cc(1270)] Obtained proxy settings from annotation hash code 11258689
[0818/124215.660249:VERBOSE1:pref_proxy_config_tracker_impl.cc(187)] 0x7f24b006cc20: set chrome proxy config service to 0x7f24b002bfe0
[0818/124215.660637:VERBOSE1:cdm_registration.cc(185)] Registering component updated Widevine 4.10.2449.0
[0818/124215.668571:VERBOSE1:webrtc_internals.cc(120)] Could not get the download directory.
[0818/124215.668714:VERBOSE1:media_stream_manager.cc(924)] MSM::InitializeMaybeAsync([this=0x7f24b002de20])
[0818/124215.668753:VERBOSE1:media_stream_manager.cc(924)] MDM::MediaDevicesManager()
[0818/124215.668761:VERBOSE1:media_stream_manager.cc(924)] MSM::MediaStreamManager([this=0x7f24b002de20]))
[0818/124215.680712:VERBOSE1:first_party_sets_handler_impl.cc(181)] Empty path. Failed loading serialized First-Party Sets file.
[0818/124215.680726:VERBOSE1:component_installer.cc(283)] StartRegistration for Widevine Content Decryption Module
IN CEFPrivatesComponent MyCefApp OnContextInitialized tid=17677
08-18 12:42:15 INFO CEFInitAndShutdownMgr [JavaFX Application Thread]: Initializing Chromium Embedded Framework SUCCESS
[0818/124215.682767:VERBOSE1:component_installer.cc(426)] FinishRegistration for Widevine Content Decryption Module
[0818/124215.682816:VERBOSE1:component_updater_service.cc(131)] CrxUpdateService starting up. First update attempt will take place in 60 seconds. Next update attempt will take place in 18000 seconds.
[0818/124215.682832:VERBOSE1:component_installer.cc(463)] Component ready, version 4.10.2449.0 in /home/craig/.config/cef_user_data/WidevineCdm/4.10.2449.0
[0818/124215.682926:VERBOSE1:widevine_cdm_component_installer.cc(264)] Updating hint file with Widevine CDM 4.10.2449.0
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[0818/124215.684581:VERBOSE1:vaapi_wrapper.cc(692)] InitializeVaDriver_Locked(): vaInitialize failed: unknown libva error
[0818/124215.685736:WARNING:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
[0818/124215.711428:VERBOSE1:key_storage_util_linux.cc(54)] Password storage detected desktop environment: GNOME
[0818/124215.711539:VERBOSE1:key_storage_linux.cc(123)] Selected backend for OSCrypt: GNOME_ANY
[0818/124215.730276:VERBOSE1:key_storage_linux.cc(175)] OSCrypt using Libsecret as backend.
[0818/124215.732642:VERBOSE1:key_storage_libsecret.cc(53)] Libsecret key created: 2022-07-29 04:53:37.000 UTC
[0818/124215.732668:VERBOSE1:key_storage_libsecret.cc(54)] Libsecret key last modified: 2022-07-29 04:53:37.000 UTC
[0818/124215.911581:VERBOSE1:proxy_config_service_linux.cc(1377)] Detected no-op change to proxy settings. Doing nothing.
[0818/124315.685486:VERBOSE1:network_delegate.cc(34)] NetworkDelegate::NotifyBeforeURLRequest: https://update.googleapis.com/service/update2/json?cup2key=12:ezk0MyFTmudcN3EqZwmqlp7IA6Pzx041kGnbvHSUv3U&cup2hreq=c3779422aa73b5a5a51012745e64759aa116d0c19600aaf52409f1ab86277a44
[0818/124315.842788:VERBOSE1:request_sender.cc(181)] Request completed from url: https://update.googleapis.com/service/update2/json?cup2key=12:ezk0MyFTmudcN3EqZwmqlp7IA6Pzx041kGnbvHSUv3U&cup2hreq=c3779422aa73b5a5a51012745e64759aa116d0c19600aaf52409f1ab86277a44
[0818/124315.843149:VERBOSE1:component_updater_service.cc(429)] Update completed with error 0
./kayak-designer-cef.sh: line 24: 17363 Segmentation fault      (core dumped) $JAVA $JAVA_17_ARGS $JAVA_ARGS -cp $CLASSPATH ca.digitalrapids.kayak.KayakMain