diff --git a/.idea/libraries/ktor_client_core.xml b/.idea/libraries/ktor_client_core.xml
new file mode 100644
index 000000000000..570f478e3e51
--- /dev/null
+++ b/.idea/libraries/ktor_client_core.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+ b407a81d92e6cd41f92c150f1fd3060d5fca3491ce02afb7f713424404081c7a
+
+
+ 907111c439b3bd4433d2debb687920d5f8df8c6229b68ed540805d5e3763b6a8
+
+
+ 6a72d6867330065ed461952fff19ea55ba844352f748cec1872f5bc7b21efc02
+
+
+ 1d93a45665f6744ff96cd7b97a45fb85ffec725b63bcc327d33a26a1c7e05fbd
+
+
+ 44f0b1de6b0947182d25408d1101c56cf8c01a7b809ee0152bd81d9adc9aa576
+
+
+ bff890d7ab6171551ae4f0632e9aeccb9048df31d6d73cf50abd5b330080ad3a
+
+
+ 0e05534fbc3b0941127b6ef39e705c34c367dae8b0a08290701c60e97e88fa72
+
+
+ dc35cc539f4dfa5a4ad9b391c14d06527dfac4f64b3e3f050f5143ceb215bca4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/ktor_client_java.xml b/.idea/libraries/ktor_client_java.xml
index d374eac3d0da..cf1e27af5a7f 100644
--- a/.idea/libraries/ktor_client_java.xml
+++ b/.idea/libraries/ktor_client_java.xml
@@ -1,53 +1,18 @@
-
+
580511f2299c1c0ead906fcb4bbdd24cbc8068f027b4c3ad0d8de5e900d8cabd
-
- b407a81d92e6cd41f92c150f1fd3060d5fca3491ce02afb7f713424404081c7a
-
-
- 907111c439b3bd4433d2debb687920d5f8df8c6229b68ed540805d5e3763b6a8
-
-
- 6a72d6867330065ed461952fff19ea55ba844352f748cec1872f5bc7b21efc02
-
-
- 1d93a45665f6744ff96cd7b97a45fb85ffec725b63bcc327d33a26a1c7e05fbd
-
-
- 44f0b1de6b0947182d25408d1101c56cf8c01a7b809ee0152bd81d9adc9aa576
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/ktor_client_okhttp.xml b/.idea/libraries/ktor_client_okhttp.xml
new file mode 100644
index 000000000000..0dad92139834
--- /dev/null
+++ b/.idea/libraries/ktor_client_okhttp.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+ 31f4d9cfb02da8d874f050c9841b2cb31e535f9b13a9797af4799d5b0356d10a
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/libraries/ktor-client/intellij.libraries.ktor.client.iml b/libraries/ktor-client/intellij.libraries.ktor.client.iml
index 4cbb693f7b83..4e8bf1debe8a 100644
--- a/libraries/ktor-client/intellij.libraries.ktor.client.iml
+++ b/libraries/ktor-client/intellij.libraries.ktor.client.iml
@@ -7,6 +7,7 @@
+
diff --git a/platform/build-scripts/downloader/intellij.platform.buildScripts.downloader.iml b/platform/build-scripts/downloader/intellij.platform.buildScripts.downloader.iml
index 8589a0fdf218..7009d4f3e48d 100644
--- a/platform/build-scripts/downloader/intellij.platform.buildScripts.downloader.iml
+++ b/platform/build-scripts/downloader/intellij.platform.buildScripts.downloader.iml
@@ -36,6 +36,8 @@
-
+
+
+
\ No newline at end of file
diff --git a/platform/build-scripts/downloader/src/ktor.kt b/platform/build-scripts/downloader/src/ktor.kt
index 442123825b05..2eb49108b4cd 100644
--- a/platform/build-scripts/downloader/src/ktor.kt
+++ b/platform/build-scripts/downloader/src/ktor.kt
@@ -5,7 +5,7 @@ package org.jetbrains.intellij.build
import io.ktor.client.HttpClient
import io.ktor.client.HttpClientConfig
import io.ktor.client.call.body
-import io.ktor.client.engine.java.Java
+import io.ktor.client.engine.okhttp.OkHttp
import io.ktor.client.plugins.HttpRequestRetry
import io.ktor.client.plugins.HttpTimeout
import io.ktor.client.plugins.UserAgent
@@ -23,8 +23,10 @@ import io.ktor.client.statement.HttpResponse
import io.ktor.client.statement.bodyAsChannel
import io.ktor.client.statement.bodyAsText
import io.ktor.http.HttpHeaders
+import io.ktor.util.read
+import io.ktor.utils.io.*
import io.ktor.utils.io.core.use
-import io.ktor.utils.io.nio.writePacket
+import io.ktor.utils.io.jvm.nio.copyTo
import io.opentelemetry.api.common.AttributeKey
import io.opentelemetry.api.common.Attributes
import io.opentelemetry.api.trace.Span
@@ -32,9 +34,7 @@ import io.opentelemetry.api.trace.SpanBuilder
import io.opentelemetry.api.trace.StatusCode
import io.opentelemetry.context.Context
import io.opentelemetry.extension.kotlin.asContextElement
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.runBlocking
-import kotlinx.coroutines.withContext
+import kotlinx.coroutines.*
import org.jetbrains.intellij.build.dependencies.BuildDependenciesCommunityRoot
import org.jetbrains.intellij.build.dependencies.BuildDependenciesDownloader
import org.jetbrains.intellij.build.dependencies.BuildDependenciesDownloader.Credentials
@@ -56,9 +56,13 @@ const val SPACE_REPO_HOST: String = "packages.jetbrains.team"
private val httpClient = SynchronizedClearableLazy {
// HttpTimeout is not used - CIO engine handles that
- HttpClient(Java) {
+ HttpClient(OkHttp) {
expectSuccess = true
+ engine {
+ clientCacheSize = 0
+ }
+
install(HttpTimeout) {
requestTimeoutMillis = 2.hours.inWholeMilliseconds
}
@@ -345,15 +349,44 @@ suspend fun downloadFileWithoutCaching(url: String, tempFile: Path) {
}
private suspend fun doDownloadFileWithoutCaching(client: HttpClient, url: String, file: Path): HttpResponse {
- return client.prepareGet(url).execute { httpResponse ->
- val channel = httpResponse.bodyAsChannel()
- FileChannel.open(file, WRITE_OPERATION).use { fileChannel ->
- while (!channel.isClosedForRead) {
- check(fileChannel.writePacket(channel.readRemaining(DEFAULT_BUFFER_SIZE.toLong())))
- }
+ return client.prepareGet(url).execute {
+ coroutineScope {
+ it.bodyAsChannel().copyAndClose(writeChannel(file))
}
- httpResponse
+ it
}
}
-private val WRITE_OPERATION = EnumSet.of(StandardOpenOption.WRITE, StandardOpenOption.CREATE)
\ No newline at end of file
+fun CoroutineScope.readChannel(file: Path): ByteReadChannel {
+ return writer(CoroutineName("file-reader") + Dispatchers.IO, autoFlush = false) {
+ FileChannel.open(file, StandardOpenOption.READ).use { fileChannel ->
+ @Suppress("DEPRECATION")
+ channel.writeSuspendSession {
+ while (true) {
+ val buffer = request(1)
+ if (buffer == null) {
+ channel.flush()
+ tryAwait(1)
+ continue
+ }
+
+ val rc = fileChannel.read(buffer)
+ if (rc == -1) {
+ break
+ }
+ written(rc)
+ }
+ }
+ }
+ }.channel
+}
+
+private val WRITE_NEW_OPERATION = EnumSet.of(StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW)
+
+private fun CoroutineScope.writeChannel(file: Path): ByteWriteChannel {
+ return reader(CoroutineName("file-writer") + Dispatchers.IO, autoFlush = true) {
+ FileChannel.open(file, WRITE_NEW_OPERATION).use { fileChannel ->
+ channel.copyTo(fileChannel)
+ }
+ }.channel
+}
\ No newline at end of file
diff --git a/platform/build-scripts/intellij.platform.buildScripts.iml b/platform/build-scripts/intellij.platform.buildScripts.iml
index 3c6fd21ed261..83a8910d26fe 100644
--- a/platform/build-scripts/intellij.platform.buildScripts.iml
+++ b/platform/build-scripts/intellij.platform.buildScripts.iml
@@ -238,6 +238,6 @@
-
+
\ No newline at end of file
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/CommunityLibraryLicenses.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/CommunityLibraryLicenses.kt
index b00a1f4daf5d..29f7136bbfa9 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/CommunityLibraryLicenses.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/CommunityLibraryLicenses.kt
@@ -593,7 +593,7 @@ object CommunityLibraryLicenses {
.suppliedByOrganizations("Thai Open Source Software Center Ltd"),
LibraryLicense(name = "JNA", libraryName = "jna", license = "LGPL 2.1",
url = "https://github.com/java-native-access/jna",
- licenseUrl = "https://www.opensource.org/licenses/lgpl-2.1.php"),
+ licenseUrl = "https://github.com/java-native-access/jna/blob/master/LICENSE"),
LibraryLicense(name = "Joni", libraryName = "joni", url = "https://github.com/jruby/joni")
.mit("https://github.com/jruby/joni/blob/master/LICENSE"),
LibraryLicense(name = "jps-javac-extension", libraryName = "jps-javac-extension",
@@ -618,8 +618,8 @@ object CommunityLibraryLicenses {
LibraryLicense(name = "JSON Schema (schema07.json)", attachedTo = "intellij.json", version = "draft-07",
url = "https://json-schema.org/draft-07/schema#").simplifiedBsd(),
LibraryLicense(libraryName = "jsoup", url = "https://jsoup.org").mit("https://jsoup.org/license"),
- LibraryLicense(libraryName = "jsr305", url = "https://code.google.com/p/jsr-305/")
- .newBsd("https://opensource.org/license/bsd-3-clause/")
+ LibraryLicense(libraryName = "jsr305", url = "https://github.com/amaembo/jsr-305")
+ .newBsd("https://github.com/amaembo/jsr-305/blob/master/ri/LICENSE")
.suppliedByOrganizations("JSR305 expert group"),
LibraryLicense(libraryName = "jsvg", url = "https://github.com/weisJ/jsvg").mit("https://github.com/weisJ/jsvg/blob/master/LICENSE")
.suppliedByPersons("Jannis Weis"),
@@ -698,6 +698,7 @@ object CommunityLibraryLicenses {
url = "https://github.com/EsotericSoftware/kryo")
.newBsd("https://github.com/EsotericSoftware/kryo/blob/master/LICENSE.md")
.suppliedByPersons("Nathan Sweet"),
+
LibraryLicense(libraryName = "ktor-client-auth",
url = "https://github.com/ktorio/ktor")
.apache("https://github.com/ktorio/ktor/blob/main/LICENSE")
@@ -732,10 +733,22 @@ object CommunityLibraryLicenses {
url = "https://github.com/ktorio/ktor")
.apache("https://github.com/ktorio/ktor/blob/main/LICENSE")
.suppliedByOrganizations(Suppliers.JETBRAINS),
+
LibraryLicense(name = "ktor.io TLS", libraryName = "ktor-network-tls",
url = "https://github.com/ktorio/ktor")
.apache("https://github.com/ktorio/ktor/blob/main/LICENSE")
.suppliedByOrganizations(Suppliers.JETBRAINS),
+
+ LibraryLicense(name = "Ktor Client Core",
+ libraryName = "ktor-client-core",
+ url = "https://github.com/ktorio/ktor/tree/main/ktor-client/ktor-client-core")
+ .apache("https://github.com/ktorio/ktor/blob/main/LICENSE").suppliedByOrganizations(Suppliers.JETBRAINS),
+
+ LibraryLicense(name = "Ktor Client OkHttp",
+ libraryName = "ktor-client-okhttp",
+ url = "https://github.com/ktorio/ktor/tree/main/ktor-client/ktor-client-okhttp")
+ .apache("https://github.com/ktorio/ktor/blob/main/LICENSE").suppliedByOrganizations(Suppliers.JETBRAINS),
+
LibraryLicense(name = "kXML2", libraryName = "kxml2", url = "https://sourceforge.net/projects/kxml/").simplifiedBsd(),
LibraryLicense(name = "Language Tool", libraryName = "org.languagetool:languagetool-core",
url = "https://github.com/languagetool-org/languagetool",
@@ -1008,7 +1021,7 @@ object CommunityLibraryLicenses {
.apache("https://github.com/amaembo/streamex/blob/master/LICENSE"),
LibraryLicense(name = "swingx", libraryName = "swingx", license = "LGPL 2.1",
url = "https://central.sonatype.com/artifact/org.swinglabs/swingx-core/1.6.2-2",
- licenseUrl = "https://www.opensource.org/licenses/lgpl-2.1.php")
+ licenseUrl = "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html")
.suppliedByOrganizations("Sun Microsystems, Inc."),
LibraryLicense(libraryName = "TestNG", url = "https://testng.org/")
.apache("https://github.com/cbeust/testng/blob/master/LICENSE.txt"),
diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/PlatformModules.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/PlatformModules.kt
index 3993096e3d80..cf39038234de 100644
--- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/PlatformModules.kt
+++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/PlatformModules.kt
@@ -1,5 +1,5 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
-@file:Suppress("ReplaceJavaStaticMethodWithKotlinAnalog")
+@file:Suppress("ReplaceJavaStaticMethodWithKotlinAnalog", "RedundantSuppression")
package org.jetbrains.intellij.build.impl
import com.intellij.openapi.util.JDOMUtil
@@ -295,7 +295,7 @@ internal suspend fun createPlatformLayout(projectLibrariesUsedByPlugins: SortedS
)
// sqlite - used by DB and "import settings" (temporarily)
- layout.alwaysPackToPlugin(listOf("flexmark", "okhttp", "sqlite"))
+ layout.alwaysPackToPlugin(listOf("flexmark", "sqlite"))
for (item in projectLibrariesUsedByPlugins) {
if (!layout.isProjectLibraryExcluded(item.libraryName) && !layout.isLibraryAlwaysPackedIntoPlugin(item.libraryName)) {
layout.includedProjectLibraries.add(item)
diff --git a/platform/jps-bootstrap/pom.xml b/platform/jps-bootstrap/pom.xml
index 08e697875108..7d26e0a68aa5 100644
--- a/platform/jps-bootstrap/pom.xml
+++ b/platform/jps-bootstrap/pom.xml
@@ -55,6 +55,11 @@
ktor-client-java-jvm
2.3.12
+
+ io.ktor
+ ktor-client-okhttp-jvm
+ 2.3.12
+
io.ktor
ktor-client-encoding-jvm
diff --git a/platform/testFramework/common/src/common/ThreadLeakTracker.java b/platform/testFramework/common/src/common/ThreadLeakTracker.java
index e2922f1d78aa..c9f6dcf41470 100644
--- a/platform/testFramework/common/src/common/ThreadLeakTracker.java
+++ b/platform/testFramework/common/src/common/ThreadLeakTracker.java
@@ -93,8 +93,8 @@ public final class ThreadLeakTracker {
"Monitor Ctrl-Break",
"Netty ",
"ObjectCleanerThread",
- "OkHttp ConnectionPool", // Dockers okhttp3.internal.connection.RealConnectionPool
- "OkHttp TaskRunner",
+ // see okhttp3.ConnectionPool: "this pool holds up to 5 idle connections which will be evicted after 5 minutes of inactivity"
+ "OkHttp ",
"Okio Watchdog", // Dockers "okio.AsyncTimeout.Watchdog"
"Periodic tasks thread", // com.intellij.util.concurrency.AppDelayQueue.TransferThread
"process reaper", // Thread[#46,process reaper(pid7496),10,InnocuousThreadGroup] (since JDK-8279488 part of InnocuousThreadGroup)
diff --git a/platform/util/http/intellij.platform.util.http.iml b/platform/util/http/intellij.platform.util.http.iml
index 0797c3feebd3..81fe3d5f0e4e 100644
--- a/platform/util/http/intellij.platform.util.http.iml
+++ b/platform/util/http/intellij.platform.util.http.iml
@@ -26,6 +26,7 @@
+
\ No newline at end of file