diff --git a/gradle.properties b/gradle.properties index 98e27c8fde..db8a8e19f7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -53,7 +53,7 @@ jekyll_version=4.0 # JS IR backend sometimes crashes with out-of-memory # TODO: Remove once KT-37187 is fixed -org.gradle.jvmargs=-Xmx4g +org.gradle.jvmargs=-Xmx3g kotlin.mpp.enableCompatibilityMetadataVariant=true kotlin.mpp.stability.nowarn=true diff --git a/kotlinx-coroutines-core/build.gradle b/kotlinx-coroutines-core/build.gradle index 70295b2909..0d4d708962 100644 --- a/kotlinx-coroutines-core/build.gradle +++ b/kotlinx-coroutines-core/build.gradle @@ -266,7 +266,7 @@ task jvmLincheckTest(type: Test, dependsOn: compileTestKotlinJvm) { static void configureJvmForLincheck(task) { task.minHeapSize = '1g' - task.maxHeapSize = '6g' // we may need more space for building an interleaving tree in the model checking mode + task.maxHeapSize = '4g' // we may need more space for building an interleaving tree in the model checking mode task.jvmArgs = ['--add-opens', 'java.base/jdk.internal.misc=ALL-UNNAMED', // required for transformation '--add-exports', 'java.base/jdk.internal.util=ALL-UNNAMED'] // in the model checking mode task.systemProperty 'kotlinx.coroutines.semaphore.segmentSize', '2' diff --git a/kotlinx-coroutines-core/jvm/src/debug/internal/ConcurrentWeakMap.kt b/kotlinx-coroutines-core/jvm/src/debug/internal/ConcurrentWeakMap.kt index ffb9c2dae6..b0b2660517 100644 --- a/kotlinx-coroutines-core/jvm/src/debug/internal/ConcurrentWeakMap.kt +++ b/kotlinx-coroutines-core/jvm/src/debug/internal/ConcurrentWeakMap.kt @@ -73,7 +73,7 @@ internal class ConcurrentWeakMap( while (true) { cleanWeakRef(weakRefQueue.remove() as HashedWeakRef<*>) } - } catch(e: InterruptedException) { + } catch (e: InterruptedException) { Thread.currentThread().interrupt() } } diff --git a/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt b/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt index e6cddbca1c..d358d49d1e 100644 --- a/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt +++ b/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt @@ -102,8 +102,10 @@ internal object DebugProbesImpl { } private fun stopWeakRefCleanerThread() { - weakRefCleanerThread?.interrupt() + val thread = weakRefCleanerThread ?: return weakRefCleanerThread = null + thread.interrupt() + thread.join() } public fun hierarchyToString(job: Job): String = coroutineStateLock.write { @@ -148,10 +150,11 @@ internal object DebugProbesImpl { * Private method that dumps coroutines so that different public-facing method can use * to produce different result types. */ - private inline fun dumpCoroutinesInfoImpl(create: (CoroutineOwner<*>, CoroutineContext) -> R): List = + private inline fun dumpCoroutinesInfoImpl(crossinline create: (CoroutineOwner<*>, CoroutineContext) -> R): List = coroutineStateLock.write { check(isInstalled) { "Debug probes are not installed" } capturedCoroutines + .asSequence() // Stable ordering of coroutines by their sequence number .sortedBy { it.info.sequenceNumber } // Leave in the dump only the coroutines that were not collected while we were dumping them @@ -159,7 +162,7 @@ internal object DebugProbesImpl { // Fuse map and filter into one operation to save an inline if (owner.isFinished()) null else owner.info.context?.let { context -> create(owner, context) } - } + }.toList() } /* diff --git a/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt b/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt index a6345cc55b..7e55f2e602 100644 --- a/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt +++ b/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt @@ -25,7 +25,10 @@ class ChannelSendReceiveStressTest( fun params(): Collection> = listOf(1, 2, 10).flatMap { nSenders -> listOf(1, 10).flatMap { nReceivers -> - TestChannelKind.values().map { arrayOf(it, nSenders, nReceivers) } + TestChannelKind.values() + // Workaround for bug that won't be fixed unless new channel implementation, see #2443 + .filter { it != TestChannelKind.LINKED_LIST } + .map { arrayOf(it, nSenders, nReceivers) } } } }