KMP-NativeCoroutines: Stream collect problem: com.apple.root.user-initiated-qos.cooperative

I’m facing this crash in production, this stacktrace is from crashlytics on user’s device ( iPhone 13 pro ios 16.6.1 ) i can’t reproduce locally, after searching a bit (Url) it seems to swift concurrency related but i don’t understand much, is this problem related to this library or can i catch this error somehow so it doesn’t crash the application, thanks.

Little bit context: kotlin version: 1.8.21 kmp-native-coroutines: 1.0.0-ALPHA-9 method in line index 10 structure:

// Kotlin
object OrderDetailsDomainWrapper {
    @NativeCoroutines
    fun screenStateStream(): Flow<ScreenState> {
        return stream
    }
}
Crashed: com.apple.root.user-initiated-qos.cooperative
0  libsystem_kernel.dylib         0x7578 __pthread_kill + 8
1  libsystem_pthread.dylib        0x7118 pthread_kill + 268
2  libsystem_c.dylib              0x1d178 abort + 180
3  FeatureInjection               0x438958 konan::abort() + 10
4  FeatureInjection               0x43eee8 (anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1::operator()() const + 34
5  FeatureInjection               0x43ee18 void (anonymous namespace)::$_0::operator()<(anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1>((anonymous namespace)::terminateWithUnhandledException(ObjHeader*)::$_1) + 60
6  FeatureInjection               0x43ec7c (anonymous namespace)::terminateWithUnhandledException(ObjHeader*) + 10
7  FeatureInjection               0x43ec5c (anonymous namespace)::processUnhandledException(ObjHeader*) + 516
8  FeatureInjection               0x43fc38 kotlin::ProcessUnhandledException(ObjHeader*) + 96
9  FeatureInjection               0x441604 Kotlin_ObjCExport_trapOnUndeclaredException + 36
10 FeatureInjection               0x341e10 objc2kotlin_kfun:feature.injection.modules.orderdetails#screenStateStreamNative__at__feature.injection.modules.orderdetails.OrderDetailsDomainWrapper(){}kotlin.Function3<kotlin.Function3<domain.orderdetails.models.ScreenState,kotlin.Function0<kotlin.Unit>,kotlin.Unit,kotlin.Unit>,kotlin.Function2<platform.Foundation.NSError?,kotlin.Unit,kotlin.Unit>,kotlin.Function2<platform.Foundation.NSError,kotlin.Unit,kotlin.Unit>,kotlin.Function0<kotlin.Unit>> + 568
11 iosapp                      0x7a6e4 closure #1 in OrderDetailsViewModel.collectScreenState() + 18 (OrderDetailsViewModel.swift:18)
12 libswift_Concurrency.dylib     0x41948 swift::runJobInEstablishedExecutorContext(swift::Job*) + 416
13 libswift_Concurrency.dylib     0x42868 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
14 libdispatch.dylib              0x15944 _dispatch_root_queue_drain + 396
15 libdispatch.dylib              0x16158 _dispatch_worker_thread2 + 164
16 libsystem_pthread.dylib        0xda0 _pthread_wqthread + 228
17 libsystem_pthread.dylib        0xb7c start_wqthread + 8

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Alright @rickclephas thanks for your help, will close this issue now and try to get back when having a more helpful stacktrace

Thanks for response, i will try to tinker with these workarounds and get back to you