Anybody faced with crash from Skia native code whi...
# compose-desktop
p
Anybody faced with crash from Skia native code while running Compose desktop app? I've got siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x0000000000000000 Stack trace in thread
Current thread (0x0000028e6666f7f0): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=8224, stack(0x000000b362000000,0x000000b362100000) (1024K)] Stack: [0x000000b362000000,0x000000b362100000], sp=0x000000b3620fe910, free space=1018k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [skiko-windows-x64.dll+0x4e02f1] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) J 5613 org.jetbrains.skia.impl.Managed._nInvokeFinalizer(JJ)V (0 bytes) @ 0x0000028e115b509c [0x0000028e115b5040+0x000000000000005c] J 8710 c2 org.jetbrains.skia.impl.CleanableImpl.clean()V (21 bytes) @ 0x0000028e1187197c [0x0000028e11871640+0x000000000000033c] J 9574 c2 org.jetbrains.skia.impl.Managed.close()V (124 bytes) @ 0x0000028e11948fb8 [0x0000028e11948f40+0x0000000000000078] j org.jetbrains.skiko.context.ContextHandler.dispose()V+12 j org.jetbrains.skiko.redrawer.Direct3DRedrawer.dispose()V+21 j org.jetbrains.skiko.SkiaLayer$redrawerManager$1.invoke(Lorg/jetbrains/skiko/GraphicsApi;Lorg/jetbrains/skiko/redrawer/Redrawer;)Lorg/jetbrains/skiko/redrawer/Redrawer;+11 j org.jetbrains.skiko.SkiaLayer$redrawerManager$1.invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+9 j org.jetbrains.skiko.redrawer.RedrawerManager.findNextWorkingRenderApi(Z)V+53 J 7800 c1 org.jetbrains.skiko.redrawer.Direct3DRedrawer.draw(Lkotlin/coroutines/Continuation;)Ljava/lang/Object; (476 bytes) @ 0x0000028e0a841344 [0x0000028e0a83f2a0+0x00000000000020a4] J 8204 c1 org.jetbrains.skiko.redrawer.Direct3DRedrawer$draw$1.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; (28 bytes) @ 0x0000028e0a9609c4 [0x0000028e0a9608c0+0x0000000000000104] J 5200 c2 kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Ljava/lang/Object;)V (128 bytes) @ 0x0000028e11565f4c [0x0000028e11565ee0+0x000000000000006c] J 10260 c2 kotlinx.coroutines.DispatchedTask.run()V (572 bytes) @ 0x0000028e11a07dfc [0x0000028e11a07880+0x000000000000057c] J 6274 c2 java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V java.desktop@21.0.2 (80 bytes) @ 0x0000028e1160ecac [0x0000028e1160e500+0x00000000000007ac] j java.awt.EventDispatchThread.pumpOneEventForFilters(I)V+81 java.desktop@21.0.2 j java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35 java.desktop@21.0.2 j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 java.desktop@21.0.2 j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 java.desktop@21.0.2 j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 java.desktop@21.0.2 j java.awt.EventDispatchThread.run()V+9 java.desktop@21.0.2 v ~StubRoutines::call_stub 0x0000028e10d8100d
a
You're might using the release version which use Proguard, Proguard need the rules for some libraries to work properly and you will find it in the resources of the library repository
p
Hello, Ellet! Thanks for reply, but I have already rules for it:
Copy code
-keep class kotlin.** { *; }
-keep class kotlinx.coroutines.** { *; }
-keep class org.jetbrains.skia.** { *; }
-keep class org.jetbrains.skiko.** { *; }
a
Those are for Skia and already applied by default by compose desktop gradle plugin, do you use other libraries?
p
Relating UI I'm using only core Compose libraries: ui, foundation, material3, runtime.
a
Also those rules seems to exclude libraries from minimization completely
I have a similar same issue when using Material 3 https://github.com/JetBrains/compose-multiplatform/issues/4883 https://kotlinlang.slack.com/archives/C01D6HTPATV/p1716866048253059 The default rules doesn't work with Material 3 yet
🙏 1
p
Also those rules seems to exclude libraries from minimization completely
Do you have solution for narrowing them?
a
Use those rules https://github.com/JetBrains/compose-multiplatform/blob/master/gradle-plugins%2Fcompose%2Fsrc%2Fmain%2Fresources%2Fdefault-compose-desktop-rules.pro It's already included by compose desktop Gradle plugin so you don't need to add anything new, when adding new rules, make sure to not excluding the default rules as there are different two ways to add new rules or change them
🙏 1
As for Material 3 rules issue, I haven't figured it out because I didn't tried much, if I do or find a solution, I will sent it to you.
🙏 1
Just to confirm the issue, can you temporarily try to remove usages of Material 3 to reproduce the issue if it's when using Material 3? You might want to create a new blank project or branch to test this
p
My project is heavely depends on material3. And crash is happening randomly. I'll try to minimize scope for reproducing, but i don't know from what to start yet.
a
This already has the minimal steps to reproduce https://github.com/JetBrains/compose-multiplatform/issues/4883 See if the gradle tasks that doesn't use Proguard work without this error
p
Development version (without obfuscation) never crashes yet.
a
I managed to get a workaround, see the issue on Compose desktop repository: https://github.com/JetBrains/compose-multiplatform/issues/4883#issuecomment-2142445581
🙏 1