rsocket / rsocket-kotlin

RSocket Kotlin multi-platform implementation
http://rsocket.io
Apache License 2.0
553 stars 37 forks source link

Migrate to ktor 2.0.0 eap and new native memory model #208

Closed olme04 closed 2 years ago

olme04 commented 2 years ago

Main reason for using ktor 2.0.0 EAP is support of coroutines 1.6 (non native-mt) and new native memory model. On current moment native-mt version of coroutines has some bugs, that appear in random places, and have no workarounds. In non native-mt there is no such bugs, and as anywhere, after release of ktor 2.0.0 we will need to migrate to new memory model, as ktor 2.0.0 will support only it, such change is both pro-active, and will improve developer experience.

Changes:

Note: in future PR's there will be another split of ktor transport dependencies:

TODO: update readme with new modules later in one go after new transport API and ktor integration improvements will be implemented

monsdroid commented 2 years ago

Hi, would you mind to release this as an EAP or alpha?

olme04 commented 2 years ago

@monsdroid Hey, snapshot will be available just after merging this PR, but because of buggy tests, most likely snapshot will be available after merge of #210. All of this will be merged soon. BTW, snapshots will be on Github Packages.

olme04 commented 2 years ago

Hey @monsdroid, snapshots are published now, you can take a llok on them now. Here is an example of using both ktor 2.0, rsocket-kotlin 0.15.0-SNAPSHOT and GithubPackages configuration https://github.com/olme04/rsocket-kotlin/commit/6488dd992a4e59d37d3b94cc3b7735053fe604cc Note: make sure to update all rsocket-ktor dependencies, as old snapshot versions will be used

monsdroid commented 2 years ago

Just wanted to say thanks. great work. after adjusting some imports everything works fine

olme04 commented 2 years ago

Im glad to hear it! thx! Just FYI, coming snapshots will have breaking changes, and also for now you should use same ktor eap version, as used in rsocket-kotlin as ktor isn't backward compatible during EAP :)

afTrolle commented 2 years ago

Hello @olme04, First of great work with Rsocket.

I might have misunderstood something, I assumed that 0.15.0-SNAPSHOT contains this PRs changes

However the "io.rsocket.kotlin:rsocket-transport-ktor-server:0.15.0-SNAPSHOT" artifact is using code from before this PR.

When checking the RSocketSupport class still uses ApplicationFeature not the ApplicationPlugin

You can download the snapshot directly from the github artifacts page.

you can check the rsocket-transport-ktor-server-jvm-0.15.0-20220114.090008-1-sources.jar

olme04 commented 2 years ago

Hey, @afTrolle! That's what I've mentioned in my previous comment and in PR description:

changed from: transport-ktor, transport-ktor-client/server to transport-ktor-tcp, transport-ktor-websocket-client/server + intermediate modules transport-ktor and transport-ktor-websocket

Note: make sure to update all rsocket-ktor dependencies, as old snapshot versions will be used

After this PR, there is no more rsocket-transport-ktor-server artifact published. You should use rsocket-transport-ktor-websocket-server. But because previous snapshot artifacts has same 0.15.0-SNAPSHOT version (as snapshot is published on every push to master), but differs only in build id, both old and new artifacts are fetched by gradle.

You can also take a look here on the diff from 0.14 to 0.15 snapshot for sample: https://github.com/olme04/rsocket-kotlin/commit/6488dd992a4e59d37d3b94cc3b7735053fe604cc#diff-88768ccb1ab6ab9a9996fee2a7ba5e7ee44febec724d7cf17bf04d91f535b26f

Hope this helps!

afTrolle commented 2 years ago

Okay, thank you for the explanation.