Bump Ktor version to 3.5.1 and add release details#832
Conversation
Vik Nikolova (vnikolova)
commented
Jun 26, 2026
- Bump Ktor version from 3.5.0 to 3.5.1
- Add release details
- Fix Kotlin, serialization, coroutines and logback versions inconsistencies
- Replace deprecated Kotlin functions in samples
- Replace deprecated Apache engine in samples
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughUpdated Ktor-related version pins, build plugins, and release metadata to 3.5.1. Sample code was also adjusted to use Apache5 clients, ChangesKtor 3.5.1 updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
codeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.kt (1)
10-23: 🩺 Stability & Availability | 🟡 MinorClose the
HttpClientto prevent resource leaks.The
HttpClientinstance constructed with theApache5engine initializes thread pools and network resources that are not reclaimed until the client is explicitly closed. Leaving it open in arunBlockingscope without afinallyblock oruse {}handler can cause thread leaks and prevent the JVM from exiting cleanly in repeated test runs or long-lived processes. Wrap the client usage in atry/finallyblock to ensureclient.close()is always called.Suggested fix
fun main() { runBlocking { val client = HttpClient(Apache5) + try { client.plugin(HttpSend).intercept { request -> val originalCall = execute(request) if (originalCall.response.status.value !in 100..399) { execute(request) } else { originalCall } } val response: HttpResponse = client.get("https://ktor.io") println(response.status) + } finally { + client.close() + } } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@codeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.kt` around lines 10 - 23, The HttpClient created in main with Apache5 is never closed, which can leak threads and network resources. Update the client usage around the HttpSend intercept and client.get call to ensure client.close() is always invoked, ideally by wrapping the existing runBlocking body in a try/finally or equivalent cleanup pattern so the client is released even if the request fails.codeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.kt (1)
14-27: 🩺 Stability & Availability | 🟡 MinorRelease the Apache5 client when the sample finishes.
The
HttpClient(Apache5)instance created inmainis never closed, which can lead to resource leaks (file descriptors, threads) after the sample completes. SinceHttpClientimplementsAutoCloseable, wrap the usage in auseblock for idiomatic Kotlin resource management.Suggested fix
fun main(args: Array<String>) = runBlocking<Unit> { - val client = HttpClient(Apache5) { + val client = HttpClient(Apache5) { install(ContentNegotiation) { gson() } } - println("Requesting model...") - val model: Model = client.get("http://0.0.0.0:8080/v1").body() - println("Fetching items for '${model.name}'...") - for ((key, _) in model.items) { - val item: Item = client.get("http://0.0.0.0:8080/v1/item/$key").body() - println("Received: $item") - } + client.use { + println("Requesting model...") + val model: Model = it.get("http://0.0.0.0:8080/v1").body() + println("Fetching items for '${model.name}'...") + for ((key, _) in model.items) { + val item: Item = it.get("http://0.0.0.0:8080/v1/item/$key").body() + println("Received: $item") + } + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@codeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.kt` around lines 14 - 27, The Apache5 HttpClient in main is never released after the sample completes, so update the JsonClient main flow to use Kotlin’s idiomatic resource handling by wrapping the HttpClient(Apache5) creation and all request logic in a use block on the HttpClient instance. Keep the existing request/print logic inside that block so the client is automatically closed when main finishes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@codeSnippets/snippets/custom-plugin-base-api/src/main/kotlin/com/example/plugins/DataTransformation.kt`:
- Line 16: The code snippet is already migrated to ByteReadChannel.readLine(),
but the accompanying docs prose still refers to readUTF8Line, so update the
surrounding explanation in the custom plugin documentation to match the sample
and use the new method name consistently. Check the text that describes the
DataTransformation example and replace any leftover readUTF8Line references so
the narrative stays aligned with the snippet.
---
Outside diff comments:
In
`@codeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.kt`:
- Around line 10-23: The HttpClient created in main with Apache5 is never
closed, which can leak threads and network resources. Update the client usage
around the HttpSend intercept and client.get call to ensure client.close() is
always invoked, ideally by wrapping the existing runBlocking body in a
try/finally or equivalent cleanup pattern so the client is released even if the
request fails.
In `@codeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.kt`:
- Around line 14-27: The Apache5 HttpClient in main is never released after the
sample completes, so update the JsonClient main flow to use Kotlin’s idiomatic
resource handling by wrapping the HttpClient(Apache5) creation and all request
logic in a use block on the HttpClient instance. Keep the existing request/print
logic inside that block so the client is automatically closed when main
finishes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 93cc900c-2db6-47f7-b2cf-84c9893714be
📒 Files selected for processing (38)
codeSnippets/gradle.propertiescodeSnippets/snippets/aws-elastic-beanstalk/build.gradle.ktscodeSnippets/snippets/client-custom-plugin-data-transformation/src/main/kotlin/com/example/plugins/DataTransformation.ktcodeSnippets/snippets/client-http-send/build.gradle.ktscodeSnippets/snippets/client-http-send/src/main/kotlin/com/example/Application.ktcodeSnippets/snippets/client-json/build.gradle.ktscodeSnippets/snippets/client-json/src/main/kotlin/com/example/JsonClient.ktcodeSnippets/snippets/custom-plugin-base-api/src/main/kotlin/com/example/plugins/DataTransformation.ktcodeSnippets/snippets/custom-plugin/src/main/kotlin/com/example/plugins/DataTransformationPlugin.ktcodeSnippets/snippets/deployment-ktor-plugin/build.gradle.ktscodeSnippets/snippets/engine-main-custom-environment/build.gradle.ktscodeSnippets/snippets/forwarded-header/build.gradle.ktscodeSnippets/snippets/full-stack-task-manager/gradle/libs.versions.tomlcodeSnippets/snippets/htmx-integration/build.gradle.ktscodeSnippets/snippets/legacy-interactive-website/build.gradle.ktscodeSnippets/snippets/migrating-express-ktor/gradle.propertiescodeSnippets/snippets/openapi-spec-gen-maven/pom.xmlcodeSnippets/snippets/openapi-spec-gen/build.gradle.ktscodeSnippets/snippets/opentelemetry/gradle/libs.versions.tomlcodeSnippets/snippets/proguard/build.gradle.ktscodeSnippets/snippets/server-websockets-sharedflow/build.gradle.ktscodeSnippets/snippets/session-cookie-client/src/main/kotlin/cookieclient/Application.ktcodeSnippets/snippets/session-cookie-server/src/main/kotlin/com/example/Application.ktcodeSnippets/snippets/session-header-server/src/main/kotlin/com/example/Application.ktcodeSnippets/snippets/sockets-client/src/main/kotlin/com/example/Application.ktcodeSnippets/snippets/sockets-server/src/main/kotlin/com/example/Application.ktcodeSnippets/snippets/tutorial-client-kmp/gradle/libs.versions.tomlcodeSnippets/snippets/tutorial-kotlin-rpc-app/build.gradle.ktscodeSnippets/snippets/tutorial-server-db-integration/settings.gradle.ktscodeSnippets/snippets/tutorial-server-docker-compose/build.gradle.ktscodeSnippets/snippets/tutorial-server-get-started-maven/pom.xmlcodeSnippets/snippets/tutorial-server-restful-api/settings.gradle.ktscodeSnippets/snippets/tutorial-server-web-application/settings.gradle.ktscodeSnippets/snippets/tutorial-website-static/build.gradle.ktshelp-versions.jsonproject.ihptopics/releases.mdv.list