JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.94k stars 1.16k forks source link

Fatal error during Windows desktop run #610

Open LAP2 opened 3 years ago

LAP2 commented 3 years ago

Hi team. I used 0.4.0-build184 build 1.4.32 kotlin version. And in two of three runs have crash.

Crash reports in attachment. Command line part omitted. hs_err_pid6104.log hs_err_pid18996.log Code to reproduce:


@Composable
internal fun HorizontalScrollbarContainer(
    modifier: Modifier = Modifier,
    content: @Composable (horizontalScrollState: ScrollState) -> Unit
) = Box(
    modifier = modifier.fillMaxSize()
) {
    val horizontalScrollState = rememberScrollState(0)
    content(horizontalScrollState)
    HorizontalScrollbar(
        modifier = Modifier
            .align(Alignment.BottomCenter)
            .fillMaxWidth(),
        adapter = rememberScrollbarAdapter(horizontalScrollState)
    )
}

@Composable
fun Item(index: Int) = Row(
    modifier = Modifier
        .wrapContentHeight()
        .padding(start = 30.dp * index)
        .fillMaxWidth()
) {
    Text("Item $index")
}

@Composable
fun LazyColumnView(
    modifier: Modifier = Modifier.fillMaxSize()
) = HorizontalScrollbarContainer(modifier) { horizontalScrollState ->
    LazyColumn(
        modifier.horizontalScroll(horizontalScrollState)
    ) {
        items(300) { index ->
            Item(index)
        }
    }
}

fun main() = Window(
    "2 of 3"
) {
    MaterialTheme {
        DesktopTheme {
            LazyColumnView()
        }
    }
}
olonho commented 3 years ago

Seems crash is in

j  org.jetbrains.skiko.redrawer.Direct3DRedrawer.makeDirectXRenderTarget(JII)J+0
j  org.jetbrains.skiko.redrawer.Direct3DRedrawer.makeRenderTarget(JII)Lorg/jetbrains/skija/BackendRenderTarget;+9
j  org.jetbrains.skiko.context.Direct3DContextHandler.initCanvas()V+55
j  org.jetbrains.skiko.SkiaLayer.draw()V+83
j  org.jetbrains.skiko.redrawer.Direct3DRedrawer.draw()V+4
j  org.jetbrains.skiko.redrawer.Direct3DRedrawer.redrawImmediately()V+57
j  org.jetbrains.skiko.SkiaLayer.paint(Ljava/awt/Graphics;)V+77
j  javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+523 java.desktop@15
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+318 java.desktop@15
j  javax.swing.JLayeredPane.paint(Ljava/awt/Graphics;)V+73 java.desktop@15
j  javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+523 java.desktop@15
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+318 java.desktop@15
j  javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+523 java.desktop@15
j  javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+318 java.desktop@15
Rsedaikin commented 3 years ago

What is your video card?

LAP2 commented 3 years ago

Intel(R) HD Graphics 4400 But I don't think it connected with card. Cause in one of three runs it run fine.

Rsedaikin commented 3 years ago

Try to run your application with OpenGL rendering, example code:

fun main() {
    System.setProperty("skiko.renderApi", "OPENGL")
    Window(
        ... // your window settings
    ) {
        ... // your content
    }
}
LAP2 commented 3 years ago

Tried. Works cool. I have zero crashes for 7 runs.

Genie23 commented 3 years ago

Hello,

I also got the same EXCEPTION_UNCAUGHT_CXX_EXCEPTION error when my Composer Desktop program was running with my Intel graphics chipset (Intel HD Graphics 4600 chipset to be precise). During the day, I searched on the internet for the EXCEPTION_UNCAUGHT_CXX_EXCEPTION error code, and I indeed found one (and only one) result that indicated the mood incompatibility between intel chipsets (I say them, but I don't know if all are concerned) and the applications developed with this framework.

I thought I would open an issue if none was already open on this subject, so I searched for "intel" in the already open issues and I found this one.

So I took the opportunity to test @Rsedaikin solution, and yes, it works.

So why this message ?

Several reasons :

mahozad commented 2 years ago

Update

v1.2.1 resolved the issue for me (see this pull request and this related issue).


I also have this problem when running the plain compose desktop project created by IntelliJ.

I'm currently using the workaround above suggested by @Rsedaikin.

This is the system the program is running on:

The error log ```plain # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fffddca588c, pid=11104, tid=10656 # # JRE version: OpenJDK Runtime Environment AdoptOpenJDK (11.0.9.1+1) (build 11.0.9.1+1) # Java VM: OpenJDK 64-Bit Server VM AdoptOpenJDK (11.0.9.1+1, mixed mode, tiered, compressed oops, g1 gc, windows-amd64) # Problematic frame: # C [skiko-windows-x64.dll+0x5588c] # # No core dump will be written. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # https://github.com/AdoptOpenJDK/openjdk-support/issues # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- S U M M A R Y ------------ Command Line: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3\lib\idea_rt.jar=13471:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3\bin -Dfile.encoding=UTF-8 MainKt Host: Intel(R) Core(TM) i7-4702MQ CPU @ 2.20GHz, 8 cores, 7G, Windows 10 , 64 bit Build 19041 (10.0.19041.1348) --------------- T H R E A D --------------- Current thread (0x000001d6c540a000): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=10656, stack(0x000000afa5700000,0x000000afa5800000)] Stack: [0x000000afa5700000,0x000000afa5800000], sp=0x000000afa57f9f10, free space=999k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [skiko-windows-x64.dll+0x5588c] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j org.jetbrains.skiko.redrawer.Direct3DRedrawer.makeDirectXSurface(JJIII)J+0 j org.jetbrains.skiko.redrawer.Direct3DRedrawer.makeSurface(JIII)Lorg/jetbrains/skia/Surface;+15 j org.jetbrains.skiko.context.Direct3DContextHandler.initCanvas()V+160 j org.jetbrains.skiko.context.ContextHandler.draw()V+21 j org.jetbrains.skiko.redrawer.Direct3DRedrawer.drawAndSwap(Z)V+27 j org.jetbrains.skiko.redrawer.Direct3DRedrawer.redrawImmediately()V+148 j org.jetbrains.skiko.SkiaLayer.paint(Ljava/awt/Graphics;)V+88 j androidx.compose.ui.awt.ComposeLayer$ComponentImpl.paint(Ljava/awt/Graphics;)V+12 j javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+523 java.desktop@11.0.9.1 j javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+318 java.desktop@11.0.9.1 j javax.swing.JLayeredPane.paint(Ljava/awt/Graphics;)V+73 java.desktop@11.0.9.1 j javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+523 java.desktop@11.0.9.1 j javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+318 java.desktop@11.0.9.1 j javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+523 java.desktop@11.0.9.1 j javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+318 java.desktop@11.0.9.1 j javax.swing.JLayeredPane.paint(Ljava/awt/Graphics;)V+73 java.desktop@11.0.9.1 j javax.swing.JComponent.paintChildren(Ljava/awt/Graphics;)V+523 java.desktop@11.0.9.1 j javax.swing.JComponent.paintToOffscreen(Ljava/awt/Graphics;IIIIII)V+72 java.desktop@11.0.9.1 j javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(Ljavax/swing/JComponent;Ljava/awt/Image;Ljava/awt/Graphics;IIII)V+163 java.desktop@11.0.9.1 j javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Ljavax/swing/JComponent;Ljava/awt/Image;Ljava/awt/Graphics;IIII)V+46 java.desktop@11.0.9.1 j javax.swing.RepaintManager$PaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)Z+128 java.desktop@11.0.9.1 j javax.swing.RepaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)V+51 java.desktop@11.0.9.1 j javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+221 java.desktop@11.0.9.1 j java.awt.GraphicsCallback$PaintCallback.run(Ljava/awt/Component;Ljava/awt/Graphics;)V+2 java.desktop@11.0.9.1 j sun.awt.SunGraphicsCallback.runOneComponent(Ljava/awt/Component;Ljava/awt/Rectangle;Ljava/awt/Graphics;Ljava/awt/Shape;I)V+155 java.desktop@11.0.9.1 j sun.awt.SunGraphicsCallback.runComponents([Ljava/awt/Component;Ljava/awt/Graphics;I)V+157 java.desktop@11.0.9.1 j java.awt.Container.paint(Ljava/awt/Graphics;)V+58 java.desktop@11.0.9.1 j java.awt.Window.paint(Ljava/awt/Graphics;)V+68 java.desktop@11.0.9.1 j javax.swing.RepaintManager$4.run()Ljava/lang/Void;+142 java.desktop@11.0.9.1 j javax.swing.RepaintManager$4.run()Ljava/lang/Object;+1 java.desktop@11.0.9.1 v ~StubRoutines::call_stub j java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0 java.base@11.0.9.1 j java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+18 java.base@11.0.9.1 j javax.swing.RepaintManager.paintDirtyRegions(Ljava/util/Map;)V+154 java.desktop@11.0.9.1 j javax.swing.RepaintManager.paintDirtyRegions()V+46 java.desktop@11.0.9.1 j javax.swing.RepaintManager.prePaintDirtyRegions()V+73 java.desktop@11.0.9.1 j javax.swing.RepaintManager$ProcessingRunnable.run()V+37 java.desktop@11.0.9.1 j java.awt.event.InvocationEvent.dispatch()V+47 java.desktop@11.0.9.1 j java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V+21 java.desktop@11.0.9.1 j java.awt.EventQueue$4.run()Ljava/lang/Void;+32 java.desktop@11.0.9.1 j java.awt.EventQueue$4.run()Ljava/lang/Object;+1 java.desktop@11.0.9.1 v ~StubRoutines::call_stub j java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0 java.base@11.0.9.1 j java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+18 java.base@11.0.9.1 j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+46 java.desktop@11.0.9.1 j java.awt.EventDispatchThread.pumpOneEventForFilters(I)V+78 java.desktop@11.0.9.1 j java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35 java.desktop@11.0.9.1 j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 java.desktop@11.0.9.1 j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 java.desktop@11.0.9.1 j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 java.desktop@11.0.9.1 j java.awt.EventDispatchThread.run()V+9 java.desktop@11.0.9.1 v ~StubRoutines::call_stub siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x0000000000000000 Register to memory mapping: [...] ```
YektaDev commented 2 years ago

I used to have no problem running my app before version v1.2.0-alpha01-dev770 . When I tried v1.2.0-alpha01-dev770 or now, v1.2.0-alpha01-dev774, the application fails to run with:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffab1886716, pid=1264, tid=9704
#
# JRE version: OpenJDK Runtime Environment (11.0.12+7) (build 11.0.12+7-b1504.28-7817840)
# Java VM: OpenJDK 64-Bit Server VM (11.0.12+7-b1504.28-7817840, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [skiko-windows-x64.dll+0x56716]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

But thankfully, after trying out:

...Try to run your application with OpenGL rendering, example code:

System.setProperty("skiko.renderApi", "OPENGL")

the issue disappeared.

okushnikov commented 3 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.