Skip to content

Commit aa86ff3

Browse files
committed
Revert "BlockHound integration (#1821)"
This reverts commit ed7c668.
1 parent 6802f7b commit aa86ff3

21 files changed

+65
-276
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ apply from: rootProject.file("gradle/experimental.gradle")
88
def rootModule = "kotlinx.coroutines"
99
def coreModule = "kotlinx-coroutines-core"
1010
// Not applicable for Kotlin plugin
11-
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing']
12-
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing']
11+
def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'publication-validator']
12+
def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'publication-validator']
1313
// Not published
1414
def unpublished = internal + ['example-frontend-js', 'android-unit-tests']
1515

gradle.properties

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ knit_version=0.1.3
1414
html_version=0.6.8
1515
lincheck_version=2.5.3
1616
dokka_version=0.9.16-rdev-2-mpp-hacks
17-
byte_buddy_version=1.10.7
17+
byte_buddy_version=1.9.3
1818
reactor_vesion=3.2.5.RELEASE
1919
reactive_streams_version=1.0.2
2020
rxjava2_version=2.2.8
2121
javafx_version=11.0.2
2222
javafx_plugin_version=0.0.8
2323
binary_compatibility_validator_version=0.2.2
24-
blockhound_version=1.0.2.RELEASE
25-
jna_version=5.5.0
2624

2725
# Android versions
2826
android_version=4.1.1.4

integration-testing/README.md

-14
This file was deleted.

integration-testing/build.gradle

-77
This file was deleted.

integration-testing/src/debugAgentTest/kotlin/DebugAgentTest.kt

-20
This file was deleted.

kotlinx-coroutines-core/jvm/src/scheduling/CoroutineScheduler.kt

-17
Original file line numberDiff line numberDiff line change
@@ -951,20 +951,3 @@ internal class CoroutineScheduler(
951951
TERMINATED
952952
}
953953
}
954-
955-
/**
956-
* Checks if the thread is part of a thread pool that supports coroutines.
957-
* This function is needed for integration with BlockHound.
958-
*/
959-
@Suppress("UNUSED")
960-
@JvmName("isSchedulerWorker")
961-
internal fun isSchedulerWorker(thread: Thread) = thread is CoroutineScheduler.Worker
962-
963-
/**
964-
* Checks if the thread is running a CPU-bound task.
965-
* This function is needed for integration with BlockHound.
966-
*/
967-
@Suppress("UNUSED")
968-
@JvmName("mayNotBlock")
969-
internal fun mayNotBlock(thread: Thread) = thread is CoroutineScheduler.Worker &&
970-
thread.state == CoroutineScheduler.WorkerState.CPU_ACQUIRED

kotlinx-coroutines-debug/README.md

-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ suspension stacktraces.
1313
Additionally, it is possible to process the list of such coroutines via [DebugProbes.dumpCoroutinesInfo] or dump isolated parts
1414
of coroutines hierarchy referenced by a [Job] or [CoroutineScope] instances using [DebugProbes.printJob] and [DebugProbes.printScope] respectively.
1515

16-
This module also provides an automatic [BlockHound](https://github.com/reactor/BlockHound) integration
17-
that detects when a blocking operation was called in a coroutine context that prohibits it. In order to use it,
18-
please follow the BlockHound [quick start guide](
19-
https://github.com/reactor/BlockHound/blob/1.0.2.RELEASE/docs/quick_start.md).
20-
2116
### Using in your project
2217

2318
Add `kotlinx-coroutines-debug` to your project test dependencies:

kotlinx-coroutines-debug/api/kotlinx-coroutines-debug.api

-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ public final class kotlinx/coroutines/debug/CoroutineInfo {
88
public fun toString ()Ljava/lang/String;
99
}
1010

11-
public final class kotlinx/coroutines/debug/CoroutinesBlockHoundIntegration : reactor/blockhound/integration/BlockHoundIntegration {
12-
public fun <init> ()V
13-
public fun applyTo (Lreactor/blockhound/BlockHound$Builder;)V
14-
}
15-
1611
public final class kotlinx/coroutines/debug/DebugProbes {
1712
public static final field INSTANCE Lkotlinx/coroutines/debug/DebugProbes;
1813
public final fun dumpCoroutines (Ljava/io/PrintStream;)V

kotlinx-coroutines-debug/build.gradle

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ dependencies {
2222
compileOnly "junit:junit:$junit_version"
2323
shadowDeps "net.bytebuddy:byte-buddy:$byte_buddy_version"
2424
shadowDeps "net.bytebuddy:byte-buddy-agent:$byte_buddy_version"
25-
compileOnly "io.projectreactor.tools:blockhound:$blockhound_version"
26-
testCompile "io.projectreactor.tools:blockhound:$blockhound_version"
27-
runtime "net.java.dev.jna:jna:$jna_version"
28-
runtime "net.java.dev.jna:jna-platform:$jna_version"
2925
}
3026

3127
jar {
@@ -39,5 +35,5 @@ shadowJar {
3935
classifier null
4036
// Shadow only byte buddy, do not package kotlin stdlib
4137
configurations = [project.configurations.shadowDeps]
42-
relocate('net.bytebuddy', 'kotlinx.coroutines.repackaged.net.bytebuddy')
38+
relocate 'net.bytebuddy', 'kotlinx.coroutines.repackaged.net.bytebuddy'
4339
}

kotlinx-coroutines-debug/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration

-1
This file was deleted.

kotlinx-coroutines-debug/src/CoroutinesBlockHoundIntegration.kt

-16
This file was deleted.

kotlinx-coroutines-debug/src/internal/DebugProbesImpl.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ internal object DebugProbesImpl {
5757
public fun install(): Unit = coroutineStateLock.write {
5858
if (++installations > 1) return
5959

60-
ByteBuddyAgent.install(ByteBuddyAgent.AttachmentProvider.ForEmulatedAttachment.INSTANCE)
60+
ByteBuddyAgent.install()
6161
val cl = Class.forName("kotlin.coroutines.jvm.internal.DebugProbesKt")
6262
val cl2 = Class.forName("kotlinx.coroutines.debug.DebugProbesKt")
6363

kotlinx-coroutines-debug/test/BlockHoundTest.kt

-73
This file was deleted.

kotlinx-coroutines-debug/test/CoroutinesDumpTest.kt

+5-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CoroutinesDumpTest : DebugTestBase() {
3939

4040
@Test
4141
fun testRunningCoroutine() = runBlocking {
42-
val deferred = async(Dispatchers.IO) {
42+
val deferred = async(Dispatchers.Default) {
4343
activeMethod(shouldSuspend = false)
4444
assertTrue(true)
4545
}
@@ -70,7 +70,7 @@ class CoroutinesDumpTest : DebugTestBase() {
7070

7171
@Test
7272
fun testRunningCoroutineWithSuspensionPoint() = runBlocking {
73-
val deferred = async(Dispatchers.IO) {
73+
val deferred = async(Dispatchers.Default) {
7474
activeMethod(shouldSuspend = true)
7575
yield() // tail-call
7676
}
@@ -100,7 +100,7 @@ class CoroutinesDumpTest : DebugTestBase() {
100100

101101
@Test
102102
fun testCreationStackTrace() = runBlocking {
103-
val deferred = async(Dispatchers.IO) {
103+
val deferred = async(Dispatchers.Default) {
104104
activeMethod(shouldSuspend = true)
105105
}
106106

@@ -129,7 +129,7 @@ class CoroutinesDumpTest : DebugTestBase() {
129129

130130
@Test
131131
fun testFinishedCoroutineRemoved() = runBlocking {
132-
val deferred = async(Dispatchers.IO) {
132+
val deferred = async(Dispatchers.Default) {
133133
activeMethod(shouldSuspend = true)
134134
}
135135

@@ -149,10 +149,7 @@ class CoroutinesDumpTest : DebugTestBase() {
149149
if (shouldSuspend) yield()
150150
notifyCoroutineStarted()
151151
while (coroutineContext[Job]!!.isActive) {
152-
try {
153-
Thread.sleep(60_000)
154-
} catch (_ : InterruptedException) {
155-
}
152+
runCatching { Thread.sleep(60_000) }
156153
}
157154
}
158155

kotlinx-coroutines-debug/test/RunningThreadStackMergeTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class RunningThreadStackMergeTest : DebugTestBase() {
133133
}
134134

135135
private fun CoroutineScope.launchEscapingCoroutineWithoutContext() {
136-
launch(Dispatchers.IO) {
136+
launch(Dispatchers.Default) {
137137
suspendingFunctionWithoutContext()
138138
assertTrue(true)
139139
}

0 commit comments

Comments
 (0)