KevinnZou / compose-webview-multiplatform

WebView for JetBrains Compose Multiplatform
https://kevinnzou.github.io/compose-webview-multiplatform/
Apache License 2.0
526 stars 69 forks source link

App crashes on desktop with IllegalAccessError: class org.cef.browser.platform.CefBrowserWindowPlatform #102

Open marschwar opened 9 months ago

marschwar commented 9 months ago

When I try to load a page in a WebView, the app crashes on desktop. It works perfectly fine on android and ios. I did follow the direction on the desktop readme page and something was downloaded when starting the app (from Android Studio).

WebViewMultiplatform: 1.8.8 OS: macOS 14.2.1 Kotlin: 1.9.21 Compose Plugin: 1.6.0-beta02

Stacktrace Executing tasks: [desktopRun] in project /Users/ms/git/sekolah/apps/composeApp 2024-02-07 13:39:10.820 java[35254:1013717] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES. JCEF(39:11:385): initialized stderr logger, severity=LOGSEVERITY_DEFAULT JCEF_I(39:11:389): CefApp: set state NEW JCEF_V(39:11:392): Fixed args: [--framework-dir-path=/Users/ms/git/sekolah/apps/composeApp/kcef-bundle/Frameworks/Chromium Embedded Framework.framework, --browser-subprocess-path=/Users/ms/git/sekolah/apps/composeApp/kcef-bundle/Frameworks/jcef Helper.app/Contents/MacOS/jcef Helper, --main-bundle-path=/Users/ms/git/sekolah/apps/composeApp/kcef-bundle/Frameworks/jcef Helper.app] JCEF_I(39:11:393): CefApp: set state INITIALIZING JCEF_V(39:11:394): Initialize CefApp on Thread[CefInitialize-thread,6,main] [0207/133911.458017:WARNING:policy_logger.cc(151)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(88) Could not create policy manager as CBCM is not enabled. JCEF_V(39:11:509): CefApp: native initialization is finished. JCEF_I(39:11:509): CefApp: set state INITIALIZED JCEF_I(39:11:511): version: JCEF Version = 119.4.7.749.4467854d5d810e0758a861c8ebbc622f11fb7809 CEF Version = 119.4.7 Chromium Version = 119.0.6045.199 | settings: browser_subprocess_path=/Users/ms/git/sekolah/apps/composeApp/kcef-bundle/Frameworks/jcef Helper.app/Contents/MacOS/jcef Helper, windowless_rendering_enabled=true, command_line_args_disabled=false, cache_path=/Users/ms/git/sekolah/apps/composeApp/cache, persist_session_cookies=false, user_agent=null, user_agent_product=null, locale=null, log_file=null, log_severity=LOGSEVERITY_DEFAULT, javascript_flags=null, resources_dir_path=null, locales_dir_path=null, pack_loading_disabled=false, remote_debugging_port=0, uncaught_exception_stack_size=0, cookieable_schemes_list=null, cookieable_schemes_exclude_defaults=false, no_sandbox=true JCEF_W(39:24:360): failed to retrieve platform window handle java.lang.IllegalAccessError: class org.cef.browser.platform.CefBrowserWindowPlatform (in unnamed module @0x3cb906f6) cannot access class sun.awt.AWTAccessor (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @0x3cb906f6 at org.cef.browser.platform.CefBrowserWindowPlatform.getWindowHandle(CefBrowserWindowPlatform.java:28) at org.cef.browser.CefBrowserWr.getWindowHandle(CefBrowserWr.java:434) at org.cef.browser.CefBrowserWr$3.addNotify(CefBrowserWr.java:321) at java.desktop/java.awt.Container.addNotify(Unknown Source) at java.desktop/javax.swing.JComponent.addNotify(Unknown Source) at java.desktop/java.awt.Container.lambda$addImpl$0(Unknown Source) at java.desktop/sun.awt.SunToolkit.lambda$performWithTreeLock$1(Unknown Source) at java.desktop/sun.awt.SunToolkit.performOnMainThreadIfNeeded(Unknown Source) at java.desktop/sun.awt.SunToolkit.performWithTreeLock(Unknown Source) at java.desktop/java.awt.Container.addImpl(Unknown Source) at java.desktop/javax.swing.JLayeredPane.addImpl(Unknown Source) at java.desktop/java.awt.Container.add(Unknown Source) at androidx.compose.ui.scene.ComposeSceneMediator.addToLayer(ComposeSceneMediator.desktop.kt:388) at androidx.compose.ui.scene.ComposeSceneMediator.addToComponentLayer(ComposeSceneMediator.desktop.kt:396) at androidx.compose.ui.scene.ComposeContainer.addToComponentLayer(ComposeContainer.desktop.kt:198) at androidx.compose.ui.awt.ComposeWindowPanel.add(ComposeWindowPanel.desktop.kt:136) at androidx.compose.ui.awt.SwingPanel_desktopKt$SwingPanel$4.invoke(SwingPanel.desktop.kt:154) at androidx.compose.ui.awt.SwingPanel_desktopKt$SwingPanel$4.invoke(SwingPanel.desktop.kt:115) at androidx.compose.runtime.DisposableEffectImpl.onRemembered(Effects.kt:82) at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1285) at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:982) at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:1003) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:639) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:551) at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42) at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71) at androidx.compose.ui.scene.BaseComposeScene.render(BaseComposeScene.skiko.kt:163) at androidx.compose.ui.scene.ComposeSceneMediator$DesktopSkikoView.onRender(ComposeSceneMediator.desktop.kt:490) at org.jetbrains.skiko.SkiaLayer.update$skiko(SkiaLayer.awt.kt:548) at org.jetbrains.skiko.redrawer.AWTRedrawer.update(AWTRedrawer.kt:54) at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invokeSuspend(MetalRedrawer.kt:82) at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invoke(MetalRedrawer.kt) at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invoke(MetalRedrawer.kt) at org.jetbrains.skiko.FrameDispatcher$job$1.invokeSuspend(FrameDispatcher.kt:33) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) java.lang.IllegalAccessError: class org.cef.browser.platform.CefBrowserWindowPlatform (in unnamed module @0x3cb906f6) cannot access class sun.awt.AWTAccessor (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @0x3cb906f6 at org.cef.browser.platform.CefBrowserWindowPlatform.getWindowHandle(CefBrowserWindowPlatform.java:28) at org.cef.browser.CefBrowserWr.getWindowHandle(CefBrowserWr.java:434) at org.cef.browser.CefBrowserWr.getWindowHandle(CefBrowserWr.java:426) at org.cef.browser.CefBrowserWr.createBrowserIfRequired(CefBrowserWr.java:495) at org.cef.browser.CefBrowserWr$1$1.run(CefBrowserWr.java:65) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x0000000101813c48, pid=35254, tid=53779 # # JRE version: OpenJDK Runtime Environment (17.0.7) (build 17.0.7+0-17.0.7b1000.6-10550314) # Java VM: OpenJDK 64-Bit Server VM (17.0.7+0-17.0.7b1000.6-10550314, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64) # Problematic frame: # V [libjvm.dylib+0x123c48] AccessInternal::PostRuntimeDispatch, (AccessInternal::BarrierType)2, 548964ull>::oop_access_barrier(void*)+0x8 # # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # JNI global refs: JNI global refs: 156, weak refs: 6 JNI global refs memory usage: 2099, weak refs: 833 OOME stack traces (most recent first): Classloader memory used: Loader jdk.internal.loader.ClassLoaders$AppClassLoader : 2440K Loader bootstrap : 2002K Loader jdk.internal.loader.ClassLoaders$PlatformClassLoader : 1569B # An error report file with more information is saved as: # /Users/ms/git/sekolah/apps/composeApp/hs_err_pid35254.log # # If you would like to submit a bug report, please visit: # https://bugreport.java.com/bugreport/crash.jsp # FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':composeApp:desktopRun'. > Process 'command '/Users/ms/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java'' finished with non-zero exit value 134 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 14s
KevinnZou commented 9 months ago

@marschwar Thanks for your feedback! Could have a try with the configuration mentioned in this reply

marschwar commented 9 months ago

The app still crashes but the stack trace seems to be different. I also tried a few different JVM implementations.

Stacktrace ``` ------------------------------------------------------------ Gradle 8.4 ------------------------------------------------------------ Build time: 2023-10-04 20:52:13 UTC Revision: e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f Kotlin: 1.9.10 Groovy: 3.0.17 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 17.0.9 (Eclipse Adoptium 17.0.9+9) OS: Mac OS X 14.2.1 aarch64 ➜ apps git:(mob/main-themes) ✗ gw :composeApp:desktopRun -DmainClass=MainKt --info ... > Task :composeApp:desktopRun Caching disabled for task ':composeApp:desktopRun' because: Build cache is disabled Task ':composeApp:desktopRun' is not up-to-date because: Task has not declared any outputs despite executing actions. Starting process 'command '/Users/ms/.sdkman/candidates/java/17.0.9-tem/bin/java''. Working directory: /Users/ms/git/sekolah/apps/composeApp Command: /Users/ms/.sdkman/candidates/java/17.0.9-tem/bin/java --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.peer=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.lwawt=ALL-UNNAMED --add-opens java.desktop/sun.lwawt.macosx=ALL-UNNAMED -Dfile.encoding=UTF-8 -Duser.country=DE -Duser.language=en -Duser.variant -cp /Users/ms/git/sekolah/apps/composeApp/build/classes/kotlin/desktop/main:/Users/ms/git/sekolah/apps/composeApp/build/processedResources/desktop/main:/Users/ms/git/sekolah/apps/composeApp/flavors/hsf/build/libs/hsf-jvm.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.github.kevinnzou/compose-webview-multiplatform-desktop/1.8.8/c92e1e49eb7112e67bf3656b157ddee0a4780930/webview-desktop.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.material3/material3-desktop/1.6.0-beta02/7d20c28a05d3ce16f9ea39ef40843bb80fba139b/material3-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.components/components-resources-desktop/1.6.0-beta02/b1aae46617d50fa2da62d58bfca85710a8950a8d/library-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.arkivanov.decompose/extensions-compose-jvm/3.0.0-alpha05/f68e412cf0199bdd22ee314afeacedceb9989a72/extensions-compose-jvm-3.0.0-alpha05.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.desktop/desktop-jvm/1.6.0-beta02/9504e3dc79eed5b8cf033d64858a8d455aaa863c/desktop-jvm-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.material/material-desktop/1.6.0-beta02/bf5e7e6ccb44d7e80fc3c78595986fa85b21df1f/material-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.material/material-ripple-desktop/1.6.0-beta02/211b0740ee3291b32ee3ed9dc224f8b526fe5923/material-ripple-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.foundation/foundation-desktop/1.6.0-beta02/ff095ba07ea1a14d5f6127d2c215a2ed55eaf510/foundation-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.animation/animation-desktop/1.6.0-beta02/7310fe12edbe550939eb708f7852358c793ffa72/animation-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.foundation/foundation-layout-desktop/1.6.0-beta02/1b2b7d9b14bf90039b65e65e7a2b59fb6557008d/foundation-layout-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.animation/animation-core-desktop/1.6.0-beta02/fcf1a5244aeb02cc20286436d1206a2881e3f954/animation-core-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.material/material-icons-core-desktop/1.6.0-beta02/47e99680d4e5f234dc4514fd12fec4daf1af4597/material-icons-core-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.ui/ui-desktop/1.6.0-beta02/669b9c8bf7014ad220f9125b89f1a90fa00434c9/ui-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.ui/ui-text-desktop/1.6.0-beta02/a6f06d5084ad1f689aee8d29c643bf3085c643bc/ui-text-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.ui/ui-graphics-desktop/1.6.0-beta02/9e80f1f2e3104ef38e6e274576c8162bd9854afe/ui-graphics-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.runtime/runtime-saveable-desktop/1.6.0-beta02/1b72e4ff3c9e4940a90001c93a3108725e90dc34/runtime-saveable-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.ui/ui-unit-desktop/1.6.0-beta02/6489dd3c2b6122e1ebba9e9c1081779dc4e125ee/ui-unit-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.ui/ui-geometry-desktop/1.6.0-beta02/7eae6ed5c40e7e61eb16c2c7edfbd2019f2c239d/ui-geometry-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.ui/ui-tooling-preview-desktop/1.6.0-beta02/62232c44c61692b56d3071c29b0f9c8481b20574/ui-tooling-preview-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.runtime/runtime-desktop/1.6.0-beta02/539dd1bbfb3ce45008c4e0bb75e1f1fd0331320f/runtime-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/co.touchlab/kermit-jvm/2.0.3/e6998ae01e162e652dd7dd17934f8a4ad0c41718/kermit-jvm-2.0.3.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.arkivanov.decompose/decompose-jvm/3.0.0-alpha05/49b79d61abfe9774cf9682ed66782f6c1d20a10a/decompose-jvm-3.0.0-alpha05.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.arkivanov.essenty/lifecycle-coroutines-jvm/2.0.0-alpha04/8ba5f86687001c7329b9942b47fe71b99bf44a40/lifecycle-coroutines-jvm-2.0.0-alpha04.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.russhwolf/multiplatform-settings-no-arg-jvm/1.1.1/170bfdb6a98fdbe71b4330770fbc1c0915ff749d/multiplatform-settings-no-arg-jvm-1.1.1.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.russhwolf/multiplatform-settings-coroutines-jvm/1.1.1/4af3ac0064a2d837fe15569c2953b3b473496198/multiplatform-settings-coroutines-jvm-1.1.1.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/dev.datlag/kcef/2024.01.07.1/b87f1572ccf5dea5b0f2d9aeeda5457cbc74c55f/kcef-2024.01.07.1.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.skiko/skiko-awt-runtime-macos-arm64/0.7.90/73b5094c91577e1e670d87d6661135472f93e462/skiko-awt-runtime-macos-arm64-0.7.90.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.skiko/skiko-awt/0.7.90/99e533b9554bdb885846c28a4d805325d711e32f/skiko-awt-0.7.90.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/dev.datlag/jcef/2024.01.07.1/34f24897e5e71674d52214e98b759271d8516ab0/jcef-2024.01.07.1.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-okhttp-jvm/2.3.4/93a5f3aa1a2ef750e5a3a95a27576d2e5c6bea21/ktor-client-okhttp-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-content-negotiation-jvm/2.3.4/acb20f3b68ae0c265f16607ffd03a3ec89eb0f99/ktor-client-content-negotiation-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-core-jvm/2.3.4/7e6b050441579959bf26d2f07143099809d7b276/ktor-client-core-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-serialization-kotlinx-json-jvm/2.3.4/4d34f83abd1202a0daa7cfa464a25f2db3606b08/ktor-serialization-kotlinx-json-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/4.11.0/436932d695b2c43f2c86b8111c596179cd133d56/okhttp-4.11.0.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-events-jvm/2.3.4/1d08d8375a808a2832f3a5f52c8e088c1ab2c86f/ktor-events-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-websocket-serialization-jvm/2.3.4/a6d6a02d434ca6894655f1f3c199c1cd7b8a5b2e/ktor-websocket-serialization-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-serialization-kotlinx-jvm/2.3.4/f7c20edfc5e3af71c0d3679be1f36d76afed4096/ktor-serialization-kotlinx-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-serialization-jvm/2.3.4/b246a515c777d23e12abb7824773333cc41357f0/ktor-serialization-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-websockets-jvm/2.3.4/593843969c814e5de2f5cdb64441d6bcd0eeb010/ktor-websockets-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-http-jvm/2.3.4/dc1b1cb0e6ef918c8a432106a81a10b72304b58e/ktor-http-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio-jvm/3.4.0/4e8bd78a52ab935ce383d0092646922154295e54/okio-jvm-3.4.0.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-utils-jvm/2.3.4/ac6c349dbbe6c6f7dbe6f522531c2fad03733ef6/ktor-utils-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-io-jvm/2.3.4/9b5c5d64c49b4cd1843bd589cdc0b360ddf11480/ktor-io-jvm-2.3.4.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.9.22/dea0c11e2fa503ab891c8a090e3b54754472975d/kotlin-stdlib-jdk8-1.9.22.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-jdk8/1.8.0-RC2/b0d859f6305106bd07f61ef342039cb3bc8b7f7d/kotlinx-coroutines-jdk8-1.8.0-RC2.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-swing/1.8.0-RC2/48f194cee837747aba4fe4faa6df4d4ae110004e/kotlinx-coroutines-swing-1.8.0-RC2.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-slf4j/1.8.0-RC2/a6174f3ac8a0d99baaaa2274fd7032e242117597/kotlinx-coroutines-slf4j-1.8.0-RC2.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.8.0-RC2/7bb4e7056dbe2bab0e5584928cde6b0a4e03f264/kotlinx-coroutines-core-jvm-1.8.0-RC2.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.collection-internal/collection-desktop/1.6.0-beta02/59473b99d0a7329631eb2b5859043b62637541ea/collection-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/atomicfu-jvm/0.23.1/a4601dc42dceb031a586058e8356ff778a57dea0/atomicfu-jvm-0.23.1.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.annotation-internal/annotation-desktop/1.8.0-alpha01/bbbccda31cd1b76aec63f4a10d780e9e6dd1ec3b/annotation-desktop-1.8.0-alpha01.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.compose.ui/ui-util-desktop/1.6.0-beta02/18d22abacf8b0224d12548b03352c810b71a6f42/ui-util-desktop-1.6.0-beta02.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-datetime-jvm/0.5.0/8882b30187d18d2dcb5e22587447485e6f42dfb3/kotlinx-datetime-jvm-0.5.0.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/co.touchlab/kermit-core-jvm/2.0.3/e6b0cd7d1584d4f1f39bfea745d2a4a506892511/kermit-core-jvm-2.0.3.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.arkivanov.essenty/state-keeper-jvm/2.0.0-alpha03/30a1066fa39b177db90de4bb28c773379d06c23c/state-keeper-jvm-2.0.0-alpha03.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.arkivanov.essenty/instance-keeper-jvm/2.0.0-alpha03/ddc318beafaaf2ca118164a5c8ff8d1ce7e83b26/instance-keeper-jvm-2.0.0-alpha03.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.arkivanov.essenty/back-handler-jvm/2.0.0-alpha03/a1db24613d29c7ba37db5ae1500756e14ed26ee7/back-handler-jvm-2.0.0-alpha03.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-json-jvm/1.6.2/8f4df208edf91a3012e7a27ccd02f386d4bfc8c6/kotlinx-serialization-json-jvm-1.6.2.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-core-jvm/1.6.2/384c2492c987f1d92bfa186580de058c284b2ad9/kotlinx-serialization-core-jvm-1.6.2.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.arkivanov.essenty/lifecycle-jvm/2.0.0-alpha04/b2b269bc5b25e87ac40ef3eb180525a4d35461e8/lifecycle-jvm-2.0.0-alpha04.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.russhwolf/multiplatform-settings-jvm/1.1.1/e7180f1d8582f784a223424d0a26ba16bc07dc/multiplatform-settings-jvm-1.1.1.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.9.22/c4b17283ad7939e778989663f8301d871987fa5e/kotlin-stdlib-jdk7-1.9.22.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/com.arkivanov.essenty/utils-internal-jvm/2.0.0-alpha04/2854ef92fe0bdb96adbf9c9c6f6a3ae92ba26944/utils-internal-jvm-2.0.0-alpha04.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.22/d6c44cd08d8f3f9bece8101216dbe6553365c6e3/kotlin-stdlib-1.9.22.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/23.0.0/8cc20c07506ec18e0834947b84a864bfc094484e/annotations-23.0.0.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-compress/1.24.0/b4b1b5a3d9573b2970fddab236102c0a4d27d35e/commons-compress-1.24.0.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jogamp.gluegen/gluegen-rt/2.5.0/683e9d628c2ca32c4b56249034e164e593bf37b3/gluegen-rt-2.5.0.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.5.0/68dc55e290bd5456e87f5d47834de47633dbe754/jogl-all-2.5.0.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/6c62681a2f655b49963a5983b8b0950a6120ae14/slf4j-api-1.7.36.jar:/Users/ms/.gradle/caches/modules-2/files-2.1/antlr/antlr/2.7.7/83cd2cd674a217ade95a4bb83a8a14f351f48bd0/antlr-2.7.7.jar MainKt Successfully started process 'command '/Users/ms/.sdkman/candidates/java/17.0.9-tem/bin/java'' JCEF_I(20:00:180): CefApp: set state NEW JCEF(20:00:179): initialized stderr logger, severity=LOGSEVERITY_DEFAULT JCEF_V(20:00:183): Fixed args: [--framework-dir-path=/Users/ms/git/sekolah/apps/composeApp/kcef-bundle/Frameworks/Chromium Embedded Framework.framework, --browser-subprocess-path=/Users/ms/git/sekolah/apps/composeApp/kcef-bundle/Frameworks/jcef Helper.app/Contents/MacOS/jcef Helper, --main-bundle-path=/Users/ms/git/sekolah/apps/composeApp/kcef-bundle/Frameworks/jcef Helper.app] JCEF_I(20:00:183): CefApp: set state INITIALIZING JCEF_V(20:00:184): Initialize CefApp on Thread[CefInitialize-thread,6,main] [0211/162000.191721:WARNING:policy_logger.cc(151)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(88) Could not create policy manager as CBCM is not enabled. JCEF_V(20:00:200): CefApp: native initialization is finished. JCEF_I(20:00:201): CefApp: set state INITIALIZED JCEF_I(20:00:206): version: JCEF Version = 119.4.7.749.4467854d5d810e0758a861c8ebbc622f11fb7809 CEF Version = 119.4.7 Chromium Version = 119.0.6045.199 | settings: browser_subprocess_path=/Users/ms/git/sekolah/apps/composeApp/kcef-bundle/Frameworks/jcef Helper.app/Contents/MacOS/jcef Helper, windowless_rendering_enabled=true, command_line_args_disabled=false, cache_path=/Users/ms/git/sekolah/apps/composeApp/cache, persist_session_cookies=false, user_agent=null, user_agent_product=null, locale=null, log_file=null, log_severity=LOGSEVERITY_DEFAULT, javascript_flags=null, resources_dir_path=null, locales_dir_path=null, pack_loading_disabled=false, remote_debugging_port=0, uncaught_exception_stack_size=0, cookieable_schemes_list=null, cookieable_schemes_exclude_defaults=false, no_sandbox=true JCEF_W(20:09:828): failed to retrieve platform window handle # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x0000000103f21948, pid=4758, tid=51211 # # JRE version: OpenJDK Runtime Environment Temurin-17.0.9+9 (17.0.9+9) (build 17.0.9+9) # Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (17.0.9+9, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64) # Problematic frame: # V [libjvm.dylib+0x129948] AccessInternal::PostRuntimeDispatch, (AccessInternal::BarrierType)2, 548964ull>::oop_access_barrier(void*)+0x8 # # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /Users/ms/git/sekolah/apps/composeApp/hs_err_pid4758.log # # If you would like to submit a bug report, please visit: # https://github.com/adoptium/adoptium-support/issues # > Task :composeApp:desktopRun FAILED ```
KevinnZou commented 9 months ago

@marschwar Could you attach your build.gradle and main.kt for desktopApp?

marschwar commented 9 months ago

Thank you for looking into this. You can find the config here.

KevinnZou commented 9 months ago

Thank you for looking into this. You can find the config here.

@marschwar Thank you for your information. I have reviewed the build.gradle and main.kt files and they seem fine to me. I have also checked the latest stack trace provided above, but I cannot find the specific error message that caused the crash. Is there any additional stack trace that you can provide?

marschwar commented 9 months ago

I am sorry for the delay. I did find some information in the thread dump. I hope that is helpful to you.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000101dfbc48, pid=76398, tid=68099
#
# JRE version: OpenJDK Runtime Environment (17.0.7) (build 17.0.7+0-17.0.7b1000.6-10550314)
# Java VM: OpenJDK 64-Bit Server VM (17.0.7+0-17.0.7b1000.6-10550314, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# V  [libjvm.dylib+0x123c48]  AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<548964ull, G1BarrierSet>, (AccessInternal::BarrierType)2, 548964ull>::oop_access_barrier(void*)+0x8
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: --add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED --add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.desktop/sun.lwawt=ALL-UNNAMED --add-opens=java.desktop/sun.lwawt.macosx=ALL-UNNAMED -Dfile.encoding=UTF-8 -Duser.country=DE -Duser.language=en -Duser.variant MainKt

Host: "MacBookPro18,1" arm64, 10 cores, 32G, Darwin 23.2.0, macOS 14.2.1 (23C71)
Time: Fri Feb 23 15:13:55 2024 CET elapsed time: 8.538802 seconds (0d 0h 0m 8s)

---------------  T H R E A D  ---------------

Current thread (0x000000013b2afe00):  JavaThread "AWT-EventQueue-0" [_thread_in_vm, id=68099, stack(0x0000000171cd0000,0x0000000171ed3000)]

Stack: [0x0000000171cd0000,0x0000000171ed3000],  sp=0x0000000171ed1d90,  free space=2055k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.dylib+0x123c48]  AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<548964ull, G1BarrierSet>, (AccessInternal::BarrierType)2, 548964ull>::oop_access_barrier(void*)+0x8
V  [libjvm.dylib+0x4d2464]  jni_NewGlobalRef+0x100
C  [libjcef.dylib+0x3ee28]  ScopedJNIObjectGlobal::ScopedJNIObjectGlobal(JNIEnv_*, _jobject*)+0x2c
C  [libjcef.dylib+0x56c4]  Java_org_cef_browser_CefBrowser_1N_N_1CreateBrowser+0xcc
j  org.cef.browser.CefBrowser_N.N_CreateBrowser(Lorg/cef/handler/CefClientHandler;JLjava/lang/String;ZZLjava/awt/Component;Lorg/cef/browser/CefRequestContext;)Z+0
j  org.cef.browser.CefBrowser_N.lambda$createBrowser$1(Lorg/cef/handler/CefClientHandler;JLjava/lang/String;ZZLjava/awt/Component;)V+35
j  org.cef.browser.CefBrowser_N$$Lambda$239+0x000000080040a9b0.run()V+28
j  org.cef.browser.CefBrowser_N.executeNative(Ljava/lang/Runnable;Ljava/lang/String;)V+15
j  org.cef.browser.CefBrowser_N.createBrowser(Lorg/cef/handler/CefClientHandler;JLjava/lang/String;ZZLjava/awt/Component;)V+64
j  org.cef.browser.CefBrowserWr.createBrowserIfRequired(Z)Z+104
j  org.cef.browser.CefBrowserWr$1$1.run()V+151
J 1772 c1 java.awt.event.InvocationEvent.dispatch()V java.desktop@17.0.7 (69 bytes) @ 0x0000000105afd494 [0x0000000105afd240+0x0000000000000254]
J 1810 c1 java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V java.desktop@17.0.7 (136 bytes) @ 0x0000000105b0dcc4 [0x0000000105b0c1c0+0x0000000000001b04]
J 1819 c1 java.awt.EventQueue$3.run()Ljava/lang/Void; java.desktop@17.0.7 (60 bytes) @ 0x0000000105b15cd0 [0x0000000105b15b80+0x0000000000000150]
J 1768 c1 java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V java.desktop@17.0.7 (80 bytes) @ 0x0000000105afb114 [0x0000000105afab80+0x0000000000000594]
J 1811 c1 java.awt.EventDispatchThread.pumpOneEventForFilters(I)V java.desktop@17.0.7 (113 bytes) @ 0x0000000105b10844 [0x0000000105b10180+0x00000000000006c4]
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35 java.desktop@17.0.7
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 java.desktop@17.0.7
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 java.desktop@17.0.7
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 java.desktop@17.0.7
j  java.awt.EventDispatchThread.run()V+18 java.desktop@17.0.7
v  ~StubRoutines::call_stub
V  [libjvm.dylib+0x47757c]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x390
V  [libjvm.dylib+0x4765e8]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0xf8
V  [libjvm.dylib+0x4766b0]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x64
V  [libjvm.dylib+0x52aab4]  thread_entry(JavaThread*, JavaThread*)+0xc4
V  [libjvm.dylib+0x9b65c0]  JavaThread::thread_main_inner()+0x14c
V  [libjvm.dylib+0x9b4c2c]  Thread::call_run()+0xe0
V  [libjvm.dylib+0x7d0170]  thread_native_entry(Thread*)+0x158
C  [libsystem_pthread.dylib+0x7034]  _pthread_start+0x88

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.cef.browser.CefBrowser_N.N_CreateBrowser(Lorg/cef/handler/CefClientHandler;JLjava/lang/String;ZZLjava/awt/Component;Lorg/cef/browser/CefRequestContext;)Z+0
j  org.cef.browser.CefBrowser_N.lambda$createBrowser$1(Lorg/cef/handler/CefClientHandler;JLjava/lang/String;ZZLjava/awt/Component;)V+35
j  org.cef.browser.CefBrowser_N$$Lambda$239+0x000000080040a9b0.run()V+28
j  org.cef.browser.CefBrowser_N.executeNative(Ljava/lang/Runnable;Ljava/lang/String;)V+15
j  org.cef.browser.CefBrowser_N.createBrowser(Lorg/cef/handler/CefClientHandler;JLjava/lang/String;ZZLjava/awt/Component;)V+64
j  org.cef.browser.CefBrowserWr.createBrowserIfRequired(Z)Z+104
j  org.cef.browser.CefBrowserWr$1$1.run()V+151
J 1772 c1 java.awt.event.InvocationEvent.dispatch()V java.desktop@17.0.7 (69 bytes) @ 0x0000000105afd494 [0x0000000105afd240+0x0000000000000254]
J 1810 c1 java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V java.desktop@17.0.7 (136 bytes) @ 0x0000000105b0dcc4 [0x0000000105b0c1c0+0x0000000000001b04]
J 1819 c1 java.awt.EventQueue$3.run()Ljava/lang/Void; java.desktop@17.0.7 (60 bytes) @ 0x0000000105b15cd0 [0x0000000105b15b80+0x0000000000000150]
J 1768 c1 java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V java.desktop@17.0.7 (80 bytes) @ 0x0000000105afb114 [0x0000000105afab80+0x0000000000000594]
J 1811 c1 java.awt.EventDispatchThread.pumpOneEventForFilters(I)V java.desktop@17.0.7 (113 bytes) @ 0x0000000105b10844 [0x0000000105b10180+0x00000000000006c4]
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35 java.desktop@17.0.7
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 java.desktop@17.0.7
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 java.desktop@17.0.7
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 java.desktop@17.0.7
j  java.awt.EventDispatchThread.run()V+18 java.desktop@17.0.7
v  ~StubRoutines::call_stub

siginfo: si_signo: 11 (SIGSEGV), si_code: 2 (SEGV_ACCERR), si_addr: 0x0425000102149c78

<truncated>
KevinnZou commented 9 months ago

@DatL4g Could you have a look at this issue?

Shabinder commented 6 months ago

I am affected by this aswell.

Shabinder commented 6 months ago
image

Sample App is crashing with same isuue as well.

Shabinder commented 6 months ago

I checked out 1.6.0 using CEF, and that worked, @DatL4g issue with KCEF likely ?

DatL4g commented 6 months ago

@Shabinder Your stacktrace says that a required module is missing from export. Please make sure to specify it in your build script.

@KevinnZou A updated version is available 2024.04.20 which is compatible with the newer versions of the cef core.

Shabinder commented 6 months ago
@Shabinder Your stacktrace says that a required module is missing from export.
Please make sure to specify it in your build script.

I am using includeAllModules = true, (which exports all into binary) Without changing my build.gradle.kts, just shifting version to 1.6.0 and References of KCEF to CEF, it auto worked.

DatL4g commented 6 months ago

@Shabinder that's not 100% right.

CEF uses internal Java methods using reflection which does not work by simply specifing to include all modules.

Heres an article to get a deeper look into this arguments: https://nipafx.dev/five-command-line-options-hack-java-module-system/

It is required to use --add-opens as stated in the desktop related Readme.

Shabinder commented 6 months ago

It is required to use --add-opens as stated in the desktop related Readme.

This is done, I didnt change, following this as stated in readme, even while having this it still crashes.

francescocervone commented 6 days ago

Hi all, I solved by passing the jvm args to the JavaExec tasks instead of doing it in the compose.desktop.application lambda as described by the README.desktop.md.

tasks.withType<JavaExec> {
    jvmArgs("--add-opens", "java.desktop/sun.awt=ALL-UNNAMED")
    jvmArgs("--add-opens", "java.desktop/java.awt.peer=ALL-UNNAMED")
    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")
    }
}

I'm new to KMP so I'm not 100% sure why this happens, but when I run

./gradlew run

it works only with the standard configuration, but when I run

./gradlew desktopRun -DmainClass=com.example.MainKt --quiet

it works only with the workaround I provided (passing the arts to the JavaExec tasks).

Hopefully someone with more experience is able to explain, I need to dig in deeper to understand why, but in the meantime I thought the workaround could help people struggling with this.

francescocervone commented 6 days ago

I guess I started using the desktopRun task after following this compose multiplatform issue CMP-4666, but then, by following the links, I found out that the general recommendation on the CMP docs is to use the run task.

As far as I understand, the desktopRun task is specifically created for us by the CMP plugin, while run is the generic Java application task. Despite that, the former seems to ignore the compose.desktop.application configuration, I have no idea why, while the latter is aware of that config.

So, technically, the README.desktop.md is correct as long as you use ./gradlew run to run the desktop application.

Unfortunately, if you search the web on how to run a CMP desktop app, there is a bit of confusion about what task to run to start a KMP desktop app, as it's full of suggestions to use the desktopRun task instead (another example here from JetBrains), probably leading people to having this issue with this library (at least it was the case for me).