KMP-NativeCoroutines icon indicating copy to clipboard operation
KMP-NativeCoroutines copied to clipboard

Conflict between 1.0.0-ALPHA-46 or newer and latest room/sqlite versions

Open tellypresence opened this issue 2 months ago • 2 comments

(First, thank you for providing this important project which helps KMP projects reduce code sprawl; also as it's provided without charge I understand that volunteer development resources are likely stretched thin already)

I'm working on porting an android app to iOS via KMP. The app uses "Room" sqlite-backed DB e.g.:

  • androidx.room:room-compiler
  • androidx.room:room-runtime
  • androidx.sqlite:sqlite-bundled

For the last few months had been building and running OK using versions

Noticed recently that attempting to update KMP-NativeCoroutines project from 1.0.0-ALPHA-45 to 1.0.0-ALPHA-46 or newer can't be done if either room or sqlite are also updated to their latest version(s) i.e.

  • room updated from 2.7.2 to 2.8.X or
  • sqlite updated from 2.5.2 to 2.6.X

For now my choices are to hold KMP-NativeCoroutines project at 1.0.0-ALPHA-45, or hold both room and sqlite projects below 2.8.X/2.6.X respectively.

If I update KMP-NativeCoroutines project, and either or both of room/sqlite beyond the above limits, iOS app crashes catastrophically with error Uncaught Kotlin exception: androidx.sqlite.SQLiteException: Error code: 21 and The file path does not exist on the file system: /opt/buildAgent/.../native/internal/ObjCExportCoroutines.kt

Expand to view stack trace misuse at line 186241 of [1b37c146ee] Exception doesn't match @Throws-specified class list and thus isn't propagated from Kotlin to Objective-C/Swift as NSError. It is considered unexpected and unhandled instead. Program will be terminated. Uncaught Kotlin exception: androidx.sqlite.SQLiteException: Error code: 21 at 0 myIosApp.debug.dylib 0x10c2e3f3b kfun:kotlin.Throwable#(kotlin.String?){} + 99 at 1 myIosApp.debug.dylib 0x10c2ddcdf kfun:kotlin.Exception#(kotlin.String?){} + 95 at 2 myIosApp.debug.dylib 0x10c2ddeaf kfun:kotlin.RuntimeException#(kotlin.String?){} + 95 at 3 myIosApp.debug.dylib 0x10c69eb4f kfun:androidx.sqlite.SQLiteException#(kotlin.String){} + 95 at 4 myIosApp.debug.dylib 0x10c69e3a3 kfun:androidx.sqlite#throwSQLiteException(kotlin.Int;kotlin.String?){}kotlin.Nothing + 647 at 5 myIosApp.debug.dylib 0x10c6a1df3 kfun:androidx.sqlite.driver.NativeSQLiteDriver#open(kotlin.String;kotlin.Int){}androidx.sqlite.SQLiteConnection + 1375 at 6 myIosApp.debug.dylib 0x10c6a185f kfun:androidx.sqlite.driver.NativeSQLiteDriver#open(kotlin.String){}androidx.sqlite.SQLiteConnection + 107 at 7 myIosApp.debug.dylib 0x10c69f03b kfun:androidx.sqlite.SQLiteDriver#open(kotlin.String){}androidx.sqlite.SQLiteConnection-trampoline + 107 at 8 myIosApp.debug.dylib 0x10c70ea1f kfun:androidx.room.BaseRoomConnectionManager.DriverWrapper.BaseRoomConnectionManager$DriverWrapper$openLocked$1.invoke#internal + 435 at 9 myIosApp.debug.dylib 0x10c415353 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99 at 10 myIosApp.debug.dylib 0x10c7166fb kfun:androidx.room.concurrent.ExclusiveLock#withLock(kotlin.Function0;kotlin.Function1){0§}0:0 + 495 at 11 myIosApp.debug.dylib 0x10c70e757 kfun:androidx.room.BaseRoomConnectionManager.DriverWrapper.openLocked#internal + 579 at 12 myIosApp.debug.dylib 0x10c70e4cf kfun:androidx.room.BaseRoomConnectionManager.DriverWrapper#open(kotlin.String){}androidx.sqlite.SQLiteConnection + 191 at 13 myIosApp.debug.dylib 0x10c69f03b kfun:androidx.sqlite.SQLiteDriver#open(kotlin.String){}androidx.sqlite.SQLiteConnection-trampoline + 107 at 14 myIosApp.debug.dylib 0x10c71a42f kfun:androidx.room.coroutines.ConnectionPoolImpl.ConnectionPoolImpl$2.invoke#internal + 167 at 15 myIosApp.debug.dylib 0x10c415353 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99 at 16 myIosApp.debug.dylib 0x10c71c40b kfun:androidx.room.coroutines.Pool.tryOpenNewConnectionLocked#internal + 307 at 17 myIosApp.debug.dylib 0x10c71c027 kfun:androidx.room.coroutines.Pool.$acquireCOROUTINE$3.invokeSuspend#internal + 979 at 18 myIosApp.debug.dylib 0x10c71c293 kfun:androidx.room.coroutines.Pool.acquire#internal + 275 at 19 myIosApp.debug.dylib 0x10c71db97 kfun:androidx.room.coroutines.Pool.Pool$acquireWithTimeout$2.$invokeCOROUTINE$1.invokeSuspend#internal + 511 at 20 myIosApp.debug.dylib 0x10c71de73 kfun:androidx.room.coroutines.Pool.Pool$acquireWithTimeout$2.invoke#internal + 299 at 21 myIosApp.debug.dylib 0x10c41844b kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 115 at 22 myIosApp.debug.dylib 0x10c516427 kfun:kotlinx.coroutines.intrinsics.startUndspatched#internal + 807 at 23 myIosApp.debug.dylib 0x10c5160cb kfun:kotlinx.coroutines.intrinsics#startUndispatchedOrReturnIgnoreTimeout__at__kotlinx.coroutines.internal.ScopeCoroutine(0:1;kotlin.coroutines.SuspendFunction1){0§;1§}kotlin.Any? + 135 at 24 myIosApp.debug.dylib 0x10c4c2dbf kfun:kotlinx.coroutines.setupTimeout#internal + 443 at 25 myIosApp.debug.dylib 0x10c4c2383 kfun:kotlinx.coroutines#withTimeout#suspend(kotlin.Long;kotlin.coroutines.SuspendFunction1;kotlin.coroutines.Continuation){0§}kotlin.Any? + 395 at 26 myIosApp.debug.dylib 0x10c4c245b kfun:kotlinx.coroutines#withTimeout#suspend(kotlin.time.Duration;kotlin.coroutines.SuspendFunction1;kotlin.coroutines.Continuation){0§}kotlin.Any? + 135 at 27 myIosApp.debug.dylib 0x10c71b667 kfun:androidx.room.coroutines.Pool.$acquireWithTimeoutCOROUTINE$2.invokeSuspend#internal + 959 at 28 myIosApp.debug.dylib 0x10c71bb6f kfun:androidx.room.coroutines.Pool.acquireWithTimeout#internal + 315 at 29 myIosApp.debug.dylib 0x10c718923 kfun:androidx.room.coroutines.ConnectionPoolImpl.$useConnectionCOROUTINE$0.invokeSuspend#internal + 3019 at 30 myIosApp.debug.dylib 0x10c719577 kfun:androidx.room.coroutines.ConnectionPoolImpl#useConnection#suspend(kotlin.Boolean;kotlin.coroutines.SuspendFunction1;kotlin.coroutines.Continuation){0§}kotlin.Any? + 319 at 31 myIosApp.debug.dylib 0x10c73e867 kfun:androidx.room.coroutines.ConnectionPool#useConnection#suspend(kotlin.Boolean;kotlin.coroutines.SuspendFunction1;kotlin.coroutines.Continuation){0§}kotlin.Any?-trampoline + 127 at 32 myIosApp.debug.dylib 0x10c731a27 kfun:androidx.room.RoomConnectionManager#useConnection#suspend(kotlin.Boolean;kotlin.coroutines.SuspendFunction1;kotlin.coroutines.Continuation){0§}kotlin.Any? + 219 at 33 myIosApp.debug.dylib 0x10c73337f kfun:androidx.room.RoomDatabase#useConnection#suspend(kotlin.Boolean;kotlin.coroutines.SuspendFunction1;kotlin.coroutines.Continuation){0§}kotlin.Any? + 219 at 34 myIosApp.debug.dylib 0x10c737717 kfun:androidx.room.util.performSuspending$2.invoke#internal + 383 at 35 myIosApp.debug.dylib 0x10c41844b kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 115 at 36 myIosApp.debug.dylib 0x10c2ed947 kfun:kotlin.coroutines.intrinsics.createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$4.invokeSuspend#internal + 871 at 37 myIosApp.debug.dylib 0x10c417ccb kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result){}kotlin.Any?-trampoline + 67 at 38 myIosApp.debug.dylib 0x10c2e9f8f kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result){} + 691 at 39 myIosApp.debug.dylib 0x10c417dab kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result){}-trampoline + 99 at 40 myIosApp.debug.dylib 0x10c50a2d3 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2039 at 41 myIosApp.debug.dylib 0x10c53a96f kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 at 42 myIosApp.debug.dylib 0x10c50d373 kfun:kotlinx.coroutines.internal.LimitedDispatcher.Worker.run#internal + 359 at 43 myIosApp.debug.dylib 0x10c53a96f kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 at 44 myIosApp.debug.dylib 0x10c53267b kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$workerRunLoop$1.$invokeCOROUTINE$0.invokeSuspend#internal + 1671 at 45 myIosApp.debug.dylib 0x10c532b03 kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$workerRunLoop$1.invoke#internal + 299 at 46 myIosApp.debug.dylib 0x10c41844b kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 115 at 47 myIosApp.debug.dylib 0x10c2ed947 kfun:kotlin.coroutines.intrinsics.createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$4.invokeSuspend#internal + 871 at 48 myIosApp.debug.dylib 0x10c417ccb kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result){}kotlin.Any?-trampoline + 67 at 49 myIosApp.debug.dylib 0x10c2e9f8f kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result){} + 691 at 50 myIosApp.debug.dylib 0x10c417dab kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result){}-trampoline + 99 at 51 myIosApp.debug.dylib 0x10c50a2d3 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2039 at 52 myIosApp.debug.dylib 0x10c53a96f kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 at 53 myIosApp.debug.dylib 0x10c4aa05b kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 287 at 54 myIosApp.debug.dylib 0x10c53a6e7 kfun:kotlinx.coroutines.EventLoop#processNextEvent(){}kotlin.Long-trampoline + 51 at 55 myIosApp.debug.dylib 0x10c52b223 kfun:kotlinx.coroutines.BlockingCoroutine.joinBlocking#internal + 455 at 56 myIosApp.debug.dylib 0x10c52a043 kfun:kotlinx.coroutines#runBlocking(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1){0§}0:0 + 1467 at 57 myIosApp.debug.dylib 0x10c52a213 kfun:kotlinx.coroutines#runBlocking$default(kotlin.coroutines.CoroutineContext?;kotlin.coroutines.SuspendFunction1;kotlin.Int){0§}0:0 + 239 at 58 myIosApp.debug.dylib 0x10c5302db kfun:kotlinx.coroutines.MultiWorkerDispatcher.workerRunLoop#internal + 195 at 59 myIosApp.debug.dylib 0x10c531d5f kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.invoke#internal + 71 at 60 myIosApp.debug.dylib 0x10c531dbb kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.$invoke(){}#internal + 71 at 61 myIosApp.debug.dylib 0x10c415353 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99 at 62 myIosApp.debug.dylib 0x10c2f5af7 WorkerExecuteAfterLaunchpad + 271 at 63 myIosApp.debug.dylib 0x10c47704f _ZN6Worker19processQueueElementEb + 3247 at 64 myIosApp.debug.dylib 0x10c47622b _ZN12_GLOBAL__N_113workerRoutineEPv + 251 at 65 libsystem_pthread.dylib 0x21654b343 _pthread_start + 135 at 66 libsystem_pthread.dylib 0x216548ab7 thread_start + 7 Can't show file for stack frame : - stackNumber:10 - name: [inlined]. The file path does not exist on the file system: /opt/buildAgent/work/3b4e5b3c1f97a79b/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/ObjCExportCoroutines.kt

If there's any way to please investigate would be much appreciated; for now will hold at specific versions in order to continue development progress...

tellypresence avatar Oct 18 '25 18:10 tellypresence

Hi, thanks for the report.

Could you share some more information on what's happening / how the code is setup? It would be great if you could share some kind of reproducer.

Not much has changed between those versions (mostly just Kotlin version bumps), so I currently don't really know what could cause this conflict.

rickclephas avatar Oct 18 '25 20:10 rickclephas

May not be easy to provide reproducer project -- will keep an eye on it and post here if I learn anything more

tellypresence avatar Oct 19 '25 00:10 tellypresence