Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
/ KCEF Public archive
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Native crash with 2025.03.23 on mac #25

@sdsantos

Description

@sdsantos

Initialization code:

class WebViewSetup(
    private val filesDir: String,
    private val cacheDir: String,
    private val backgroundContext: CoroutineContext = Dispatchers.IO
) {

    private val _state = MutableStateFlow<WebViewState>(WebViewState.NotInitialized)
    val state = _state.asStateFlow()

    suspend fun initialize() {
        withContext(backgroundContext) {
            try {
                KCEF.init(builder = {
                    installDir(File(filesDir, "kcef-bundle"))

                    progress {
                        onDownloading {
                            _state.value = WebViewState.Downloading(it.coerceAtLeast(0f))
                        }
                        onInitialized {
                            _state.value = WebViewState.Initialized
                        }
                    }
                    settings {
                        cachePath = cacheDir
                    }
                }, onError = {
                    Logger.e("Error initializing WebView", it)
                    _state.value = WebViewState.Error
                }, onRestartRequired = {
                    _state.value = WebViewState.RestartRequired // Rare
                })
            } catch (e: Exception) {
                Logger.e("Error initializing WebView", e)
                _state.value = WebViewState.Error
            }
        }
    }
}

Gradle:

kotlin {
    jvm("desktop")
    jvmToolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
        vendor.set(JvmVendorSpec.JETBRAINS)
    }

    ...
}

...

compose.desktop {
    application {
        mainClass = "org.ooni.probe.MainKt"

        ...

        jvmArgs("--add-opens", "java.desktop/sun.awt=ALL-UNNAMED")
        jvmArgs("--add-opens", "java.desktop/java.awt.peer=ALL-UNNAMED") // recommended but not necessary

        if (System.getProperty("os.name").contains("Mac")) {
            jvmArgs("--add-opens", "java.desktop/sun.lwawt=ALL-UNNAMED")
            jvmArgs("--add-opens", "java.desktop/sun.lwawt.macosx=ALL-UNNAMED")
        }
    }
}

Logs:

JCEF_I(54:57:144): CefApp: set state NEW
JCEF_I(55:04:809): CefApp: set state INITIALIZING
JCEF_V(55:04:809): Initialize CefApp on Thread[CefInitialize-thread,5,main]
[0402/125504.990503:ERROR:icu_util.cc(178)] icudtl.dat not found in bundle
[0402/125504.993953:ERROR:icu_util.cc(240)] Invalid file descriptor to ICU data received.

Native crash Report:

Process:               java [16320]
Path:                  /Users/USER/Library/Java/JavaVirtualMachines/jbrsdk_jcef-17.0.14/Contents/Home/bin/java
Identifier:            java
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        java [13986]
Responsible:           studio [9028]
User ID:               501

Date/Time:             2025-04-02 12:55:06.0064 +0100
OS Version:            macOS 14.5 (23F79)
Report Version:        12
Anonymous UUID:        02F769A1-4DA8-03AC-CC61-6C780024304C

Time Awake Since Boot: 8800 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x0000000303d0d9f8

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [16320]

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   Chromium Embedded Framework   	       0x303d0d9f8 _$LT$bool$u20$as$u20$cxx..shared_ptr..SharedPtrTarget$GT$::__get::h6dcb4d1a5991bed5 + 1233636
1   Chromium Embedded Framework   	       0x303420f94 std::process::ExitStatus::success::hb18a44bf284d51af + 18365212
2   Chromium Embedded Framework   	       0x30342000c std::process::ExitStatus::success::hb18a44bf284d51af + 18361236
3   Chromium Embedded Framework   	       0x300324a30 cxxbridge1$rust_vec$u8$set_len + 232176
4   Chromium Embedded Framework   	       0x3003247a0 cxxbridge1$rust_vec$u8$set_len + 231520
5   Chromium Embedded Framework   	       0x3002fbc0c cxxbridge1$rust_vec$u8$set_len + 64716
6   Chromium Embedded Framework   	       0x3002fb968 cxxbridge1$rust_vec$u8$set_len + 64040
7   Chromium Embedded Framework   	       0x300268700 cef_initialize + 312
8   libjcef.dylib                 	       0x11c4706f0 CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, scoped_refptr<CefApp>, void*) + 184
9   libjcef.dylib                 	       0x11c42d108 +[CefHandler initialize:] + 132
10  Foundation                    	       0x19f23e3f4 __NSThreadPerformPerform + 264
11  CoreFoundation                	       0x19e0ee4d8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
12  CoreFoundation                	       0x19e0ee46c __CFRunLoopDoSource0 + 176
13  CoreFoundation                	       0x19e0ee1dc __CFRunLoopDoSources0 + 244
14  CoreFoundation                	       0x19e0ecdc8 __CFRunLoopRun + 828
15  CoreFoundation                	       0x19e0ec434 CFRunLoopRunSpecific + 608
16  HIToolbox                     	       0x1a889019c RunCurrentEventLoopInMode + 292
17  HIToolbox                     	       0x1a888fe2c ReceiveNextEventCommon + 220
18  HIToolbox                     	       0x1a888fd30 _BlockUntilNextEventMatchingListInModeWithFilter + 76
19  AppKit                        	       0x1a194bd68 _DPSNextEvent + 660
20  AppKit                        	       0x1a2141808 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700
21  libosxapp.dylib               	       0x1012fab04 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 204
22  AppKit                        	       0x1a193f09c -[NSApplication run] + 476
23  libosxapp.dylib               	       0x1012fa8e0 +[NSApplicationAWT runAWTLoopWithApp:] + 132
24  libawt_lwawt.dylib            	       0x11c06de98 +[AWTStarter starter:headless:] + 376
25  libosxapp.dylib               	       0x1012fc490 +[ThreadUtilities invokeBlockCopy:] + 28
26  Foundation                    	       0x19f23e3f4 __NSThreadPerformPerform + 264
27  CoreFoundation                	       0x19e0ee4d8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
28  CoreFoundation                	       0x19e0ee46c __CFRunLoopDoSource0 + 176
29  CoreFoundation                	       0x19e0ee1dc __CFRunLoopDoSources0 + 244
30  CoreFoundation                	       0x19e0ecdc8 __CFRunLoopRun + 828
31  CoreFoundation                	       0x19e0ec434 CFRunLoopRunSpecific + 608
32  libjli.dylib                  	       0x1013e1184 CreateExecutionEnvironment + 404
33  libjli.dylib                  	       0x1013dd1b4 JLI_Launch + 1232
34  java                          	       0x100f4fba4 main + 408
35  dyld                          	       0x19dc860e0 start + 2360

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions