https://kotlinlang.org logo
#ktor
Title
# ktor
m

Maurice Wingbermuhle

04/17/2020, 8:42 AM
Copy code
I\KtorHttpClient: REQUEST OBFUSCATED_URL failed with exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.InvokeOnCompletion@847c8
I\KtorHttpClient: REQUEST OBFUSCATED_URL failed with exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen io.ktor.util.pipeline.SuspendFunctionGun@596c8
kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[DispatchQueue@1517388, Continuation @ $runAsync$lambda-1COROUTINE$200]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
        at 0   myLib                               0x00000001060ceb13 kfun:kotlin.Error.<init>(kotlin.String?;kotlin.Throwable?)kotlin.Error + 115 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/Exceptions.kt:14:63)
        at 1   myLib                               0x0000000106629ad3 kfun:kotlinx.coroutines.CoroutinesInternalError.<init>(kotlin.String;kotlin.Throwable)kotlinx.coroutines.CoroutinesInternalError + 115 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/Exceptions.common.kt:28:77)
        at 2   myLib                               0x00000001067676ca kfun:kotlinx.coroutines.DispatchedTask.handleFatalException$kotlinx-coroutines-core(kotlin.Throwable?;kotlin.Throwable?) + 938 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/DispatchedTask.kt:93:22)
        at 3   myLib                               0x00000001067672b4 kfun:kotlinx.coroutines.DispatchedTask.run() + 3156 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/DispatchedTask.kt:64:13)
        at 4   myLib                               0x0000000105d93f35 kfun:ob.fus.client.utils.DispatchQueue.dispatch$lambda-0#internal + 85 (/Path-at-my-machine/myLib/src/iosMain/kotlin/ob/fus/client/utils/Dispatchers.kt:24:19)
        at 5   myLib                               0x0000000105d9401b kfun:io.hsdp.client.utils.DispatchQueue.$dispatch$lambda-0$FUNCTION_REFERENCE$492.invoke#internal + 59 (/Path-at-my-machine/myLib/src/iosMain/kotlin/ob/fus/client/utils/Dispatchers.kt:23:39)
        at 6   myLib                               0x0000000105d9407b kfun:io.hsdp.client.utils.DispatchQueue.$dispatch$lambda-0$FUNCTION_REFERENCE$492.$<bridge-UNN>invoke()#internal + 59 (/Path-at-my-machine/myLib/src/iosMain/kotlin/ob/fus/client/utils/Dispatchers.kt:23:39)
        at 7   myLib                               0x0000000105d94164 _687364702d636c69656e74_knbridge14 + 180 (/Path-at-my-machine/myLib/src/iosMain/kotlin/ob/fus/client/utils/Dispatchers.kt:23:39)
        at 8   libdispatch.dylib                   0x00000001042dfdd4 _dispatch_call_block_and_release + 12
        at 9   libdispatch.dylib                   0x00000001042e0d48 _dispatch_client_callout + 8
        at 10  libdispatch.dylib                   0x00000001042eede6 _dispatch_main_queue_callback_4CF + 1500
        at 11  CoreFoundation                      0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
        at 12  CoreFoundation                      0x00007fff23bceca9 __CFRunLoopRun + 2329
        at 13  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
        at 14  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
        at 15  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
        at 16  HSDP Client                         0x0000000103327f5b main + 75 (Path-at-my-machine/myContainingApp/AppDelegate.swift:7:7)
        at 17  libdyld.dylib                       0x00007fff5227ec25 start + 1
Caused by: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen io.hsdp.client.utils.$runAsync$lambda-1COROUTINE$200@36f9c78
        at 0   myLib                               0x00000001060dbec7 kfun:kotlin.Throwable.<init>(kotlin.String?)kotlin.Throwable + 87 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/Throwable.kt:22:37)
        at 1   myLib                               0x00000001060cec95 kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception + 85 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/Exceptions.kt:23:44)
        at 2   myLib                               0x00000001060ceeb5 kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException + 85 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/Exceptions.kt:34:44)
        at 3   myLib                               0x0000000106123a45 kfun:kotlin.native.concurrent.InvalidMutabilityException.<init>(kotlin.String)kotlin.native.concurrent.InvalidMutabilityException + 85 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt:22:60)
        at 4   myLib                               0x0000000106126bc8 ThrowInvalidMutabilityException + 680 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt:90:11)
        at 5   myLib                               0x0000000106518ea8 MutationCheck + 104
        at 6   myLib                               0x00000001061093f0 kfun:kotlin.coroutines.native.internal.ContinuationImpl.<set-intercepted>#internal + 96 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt:98:13)
        at 7   myLib                               0x00000001061099fc kfun:kotlin.coroutines.native.internal.ContinuationImpl.releaseIntercepted() + 428 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt:110:9)
        at 8   myLib                               0x0000000106108415 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl.resumeWith(kotlin.Result<kotlin.Any?>) + 1253 (/Users/teamcity1/teamcity_work/4d622a065c544371/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt:36:17)
        at 9   myLib                               0x0000000106767073 kfun:kotlinx.coroutines.DispatchedTask.run() + 2579 (/Users/teamcity1/teamcity_work/4d622a065c544371/backend.native/build/stdlib/kotlin/coroutines/Continuation.kt:44:5)
        at 10  myLib                               0x0000000105d93f35 kfun:io.hsdp.client.utils.DispatchQueue.dispatch$lambda-0#internal + 85 (/Path-at-my-machine/myLib/src/iosMain/kotlin/ob/fus/client/utils/Dispatchers.kt:24:19)
        at 11  myLib                               0x0000000105d9401b kfun:io.hsdp.client.utils.DispatchQueue.$dispatch$lambda-0$FUNCTION_REFERENCE$492.invoke#internal + 59 (/Path-at-my-machine/myLib/src/iosMain/kotlin/ob/fus/client/utils/Dispatchers.kt:23:39)
        at 12  myLib                               0x0000000105d9407b kfun:io.hsdp.client.utils.DispatchQueue.$dispatch$lambda-0$FUNCTION_REFERENCE$492.$<bridge-UNN>invoke()#internal + 59 (/Path-at-my-machine/myLib/src/iosMain/kotlin/ob/fus/client/utils/Dispatchers.kt:23:39)
        at 13  myLib                               0x0000000105d94164 _687364702d636c69656e74_knbridge14 + 180 (/Path-at-my-machine/myLib/src/iosMain/kotlin/ob/fus/client/utils/Dispatchers.kt:23:39)
        at 14  libdispatch.dylib                   0x00000001042dfdd4 _dispatch_call_block_and_release + 12
        at 15  libdispatch.dylib                   0x00000001042e0d48 _dispatch_client_callout + 8
        at 16  libdispatch.dylib                   0x00000001042eede6 _dispatch_main_queue_callback_4CF + 1500
        at 17  CoreFoundation                      0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
        at 18  CoreFoundation                      0x00007fff23bceca9 __CFRunLoopRun + 2329
        at 19  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
        at 20  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
        at 21  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
        at 22  My Lib                              0x0000000103327f5b main + 75 (Path-at-my-machine/myContainingApp/AppDelegate.swift:7:7)
        at 23  libdyld.dylib                       0x00007fff5227ec25 start + 1
e

e5l

04/17/2020, 8:43 AM
Hi, @Maurice Wingbermuhle. What is your version of ktor and kotlinx.coroutines?
m

Maurice Wingbermuhle

04/17/2020, 8:44 AM
Ktor 1.3.2, Coroutines 1.3.4 and kotlin 1.3.71
e

e5l

04/17/2020, 8:46 AM
Thanks. It looks like you're trying to freeze the client. The iOS client can't be used from different workers or stored in top level objects and variables for now.
The fix will be released with native multithreaded coroutines support in ktor
🎉 1
m

Maurice Wingbermuhle

04/17/2020, 8:47 AM
I'm not doing any explicit freezing myself. The issue does not seem to appear with an earlier version of Ktor, is that correct?
e

e5l

04/17/2020, 8:50 AM
It depends on kotlin-native rules of freezing, and they slightly changed between releases. Ktor doesn't support freezing at all.
m

Maurice Wingbermuhle

04/17/2020, 8:51 AM
This native multithreaded coroutines support in Ktor sounds very exciting, is it lined up for the next release?
👍 1
👌 1
2 Views