Is Ktor `2.0.0` compatible with coroutines `1.6.1-...
# ktor
n
Is Ktor
2.0.0
compatible with coroutines
1.6.1-native-mt
using the old memory model? I'm under the impression only the new memory model is supported after this was merged https://github.com/ktorio/ktor/pull/2739 ? Using the old memory model throws
Copy code
kotlin.native.IncorrectDereferenceException: Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread
        at kotlin.Throwable#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:24)
        at kotlin.Exception#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:23)
        at kotlin.RuntimeException#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:34)
        at kotlin.native.IncorrectDereferenceException#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt:34)
        at <global>.ThrowIncorrectDereferenceException(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt:105)
        at <global>.CheckGlobalsAccessible(Unknown Source)
        at io.ktor.client.plugins#<get-PLUGIN_INSTALLED_LIST>(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/common/src/io/ktor/client/plugins/HttpClientPlugin.kt:11)
        at io.ktor.client.HttpClientConfig.install$<anonymous>_1-3#internal(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClientConfig.kt:74)
        at io.ktor.client.HttpClientConfig.$install$<anonymous>_1-3$FUNCTION_REFERENCE$7.invoke#internal(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClientConfig.kt:122)
        at io.ktor.client.HttpClientConfig.$install$<anonymous>_1-3$FUNCTION_REFERENCE$7.$<bridge-UNNN>invoke(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClientConfig.kt:122)
        at io.ktor.client.HttpClientConfig#install(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClientConfig.kt:96)
        at io.ktor.client.HttpClient#<init>(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClient.kt:165)
        at io.ktor.client.HttpClient#<init>(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClient.kt:82)
        at io.ktor.client#HttpClient(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClient.kt:42)
        at io.ktor.client#HttpClient(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/posix/src/io/ktor/client/HttpClient.kt:20)
        at io.ktor.client#HttpClient$default(/Users/administrator/Documents/agent/work/8d547b974a7be21f/ktor-client/ktor-client-core/posix/src/io/ktor/client/HttpClient.kt:18)
a
@e5l
e
Hey, nope. Native MT and old memory model are not supported since Ktor 2.0.0
đź‘Ť 2
c
@e5l Out of curiosity. What was the rationale for this decision? Since Ktor is so prevalent it basically forces all downstream apps to upgrade to the new memory model. And libraries depending on Ktor are also forced to upgrade, which again effect all their downstream consumers. It seems like a pretty disruptive change? 🤔
e
There are several reasons. The old memory model is hard to support and it has many existing issues. On the other side, the new memory model has fewer restrictions - migration should be quite smooth.
Could you tell me if you have any issues with migration?
c
We (Realm) don’t have any problems…but we don’t control our downstream users…which is what we are most concerned about