touchlab / CrashKiOS

Crash reporting for Kotlin/Native iOS applications
https://crashkios.touchlab.co/
Apache License 2.0
258 stars 15 forks source link

InvalidMutabilityException when using new coroutines 1.6 memory model #23

Closed micHar closed 2 years ago

micHar commented 2 years ago

Version 0.5.0 (but 0.4.0 too, I think) crash when launched with the new memory model. Everything is fine when it's disabled.

Had this with both 1.6.0 and 1.6.0-native-mt.

Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen co.touchlab.crashkios.LogCrashHandler@36c0dd0
    at 0   shared                              0x00000001036b1250 kfun:kotlin.Throwable#<init>(kotlin.String?){} + 96
    at 1   shared                              0x00000001036a99a4 kfun:kotlin.Exception#<init>(kotlin.String?){} + 92
    at 2   shared                              0x00000001036a9bf8 kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 92
    at 3   shared                              0x00000001036debac kfun:kotlin.native.concurrent.InvalidMutabilityException#<init>(kotlin.String){} + 92
    at 4   shared                              0x00000001036dfeb8 ThrowInvalidMutabilityException + 340
    at 5   shared                              0x0000000103dbd5d0 Kotlin_AtomicReference_checkIfFrozen + 76
    at 6   shared                              0x00000001036de278 kfun:kotlin.native.concurrent.AtomicReference#<init>(1:0){} + 100
    at 7   shared                              0x0000000103b4cadc kfun:co.touchlab.crashkios.DefaultCrashHandler#<init>(){} + 180
    at 8   shared                              0x0000000103d8a82c _ZN6kotlin2mm13InitSingletonEPNS0_10ThreadDataEPP9ObjHeaderPK8TypeInfoPFvS4_ES5_ + 1352
    at 9   shared                              0x0000000103b4c174 kfun:co.touchlab.crashkios#setupCrashHandler(co.touchlab.crashkios.CrashHandler){} + 200
    at 10  shared                              0x0000000103c3a4ec kfun:com.example.shared.infrastructure.issuereporting#crashInit(co.touchlab.crashkios.CrashHandler){} + 64
    at 11  shared                              0x0000000103d78400 objc2kotlin.5569 + 140
micHar commented 2 years ago

Looks like adding kotlin.native.binary.freezing=disabled to gradle.properties. helps, so I guess it's something with atomic refs and will work out of the box in 1.6.20, right? Same thing broke ktor for me.

kpgalligan commented 2 years ago

I see the issue. Adding to the backlog.

kpgalligan commented 2 years ago

Fixed in https://github.com/touchlab/CrashKiOS/releases/tag/v0.6.0

scottobot commented 2 years ago

I've updated to 0.6.0 and am still getting this exception.

Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen co.touchlab.crashkios.LogCrashHandler@43d270 at 0 kmmsharedmodule 0x00000001126ae71b kfun:kotlin.Exception#<init>(kotlin.String?){} + 11 at 1 kmmsharedmodule 0x00000001126cbbb2 ThrowInvalidMutabilityException + 1010 at 2 kmmsharedmodule 0x00000001126ca125 kfun:kotlin.native.concurrent.AtomicReference#<init>(1:0){} + 85 at 3 kmmsharedmodule 0x000000011298c287 kfun:co.touchlab.crashkios.DefaultCrashHandler#<init>(){} + 759 at 4 kmmsharedmodule 0x0000000112d8093e objc2kotlin.6474 + 862 at 5 iosApp 0x000000010bda4c3e $s6iosApp15KMMCrashHandlerC5startyyFZ + 78