realm-kotlin
realm-kotlin copied to clipboard
Ktor 2 support
Ktor 2.0 has been released almost 5 months ago.
We are currently using Ktor 2.1.0 in our project which makes it incompatible with the Realm Kotlin SDK.
Any news on when to expect support for Ktor >= 2.0 would be greatly appreciated 🙂
Ktor 2.x forces users to use the new native memory model, so support for that would rule out any users that relies on the old memory model. You can currently opt-in for the new memory model with our library if you rely on that, but you wouldn't be able to opt out for the old memory model the other way around, so we are currently hesitant to upgrade. We are monitoring the progress of Kotlin to adopt the new memory model as the default along with the adoption of the new memory model for users and are periodically considering to upgrade ... but we are not yet comfortable doing so.
Thanks for the clarification. Unfortunately, this is bad news for us as we have already invested resources implementing the Realm Kotlin SDK which is now incompatible with the latest Ktor update in our project.
Wouldn't it be possible for you to just release a -native-mt variant of the library like other libries do (e.g. coroutines-native-mt)?
Hi @sdeff
The Ktor1 vs. Ktor2 difference is indeed very annoying, especially as as library author where we have to support a number of use cases.
We originally decided to postpone adopting Ktor 2 because we were hoping that JetBrains would announce the new memory model as stable and the default. Unfortunately, this hasn't happened yet and judging from signals from the community, not everyone is keen on moving to the new memory model until it is stable.
We had been a bit hesitant about releasing 2 versions of the library due to the overhead in testing that is required, but it is something we are evaluating, and we will probably end up having to release two versions since Ktor is basically required by all apps doing anything meaningfull.
We have a branch here https://github.com/realm/realm-kotlin/pull/782 where we are adding Ktor2 support, it isn't fully stable yet, but we are actively working on it, so we hopefully have something to share very soon.
Hi @sdeff, we have released a 1.2.0-ktor2-SNAPSHOT that should work with Ktor 2 and the new memory model only. We are still in the process of figuring out the exact details on how to release it and if it is possible to support other memory models.
But if you have a chance to try it out and see if it works for your use case, that would be great: https://github.com/realm/realm-kotlin#using-snapshots
A small update. After the announcement of Kotlin 1.7.20 and Kotlin Multiplatform Beta, we made the decision to migrate the library to the new memory model. This has the following implications:
- The minimum Kotlin version supported is now 1.7.20.
- We only support the new memory model (default in 1.7.20).
- Due to this, we were able to update to Ktor 2, including adding support for Apple Silicon targets.
- All of this was merged into
masterand is now available as a1.4.0-SNAPSHOT. You can see the full CHANGELOG here. Instructions on using a SNAPSHOT release are here. - Realm Kotlin 1.3.0 and below still support Kotlin 1.7.10 and lower, including the old memory model.
Feedback would be much appreciated if anybody can try this release. We will also be doing our own testing and then a full 1.4.0 release will be created next week unless we encounter any unforeseen bugs.
Hi, we just released 1.4.0 to maven with support to Ktor 2 and Ktor 1.7.20
Thanks all for your feedback and contributions 👍