Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
db67d8e
Debug freezing test on CI.
AlexeyKuznetsov-DD Aug 11, 2025
b4d7fd6
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 12, 2025
025e232
Trying to reproduce.
AlexeyKuznetsov-DD Aug 12, 2025
b62fc03
Trying to reproduce.
AlexeyKuznetsov-DD Aug 12, 2025
d6d4454
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 13, 2025
835f313
Trying to reproduce.
AlexeyKuznetsov-DD Aug 13, 2025
5892ac5
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 13, 2025
7cafe75
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 14, 2025
01b34c3
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 14, 2025
a1fae6a
Updated flaky tests.
AlexeyKuznetsov-DD Aug 14, 2025
375a9ff
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 14, 2025
60deecd
Trying to reproduce.
AlexeyKuznetsov-DD Aug 14, 2025
0a415ca
Trying to reproduce.
AlexeyKuznetsov-DD Aug 14, 2025
4cfbfd7
Merge branch 'alexeyk/apache-http-5-flaky-tests' into alexeyk/debug-c…
AlexeyKuznetsov-DD Aug 14, 2025
7a263b9
Trying to reproduce.
AlexeyKuznetsov-DD Aug 14, 2025
fac9597
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 15, 2025
26d7a12
Trying to reproduce.
AlexeyKuznetsov-DD Aug 15, 2025
9179563
Trying to reproduce.
AlexeyKuznetsov-DD Aug 15, 2025
16cf188
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 18, 2025
435d111
Trying to reproduce.
AlexeyKuznetsov-DD Aug 18, 2025
fdb23a4
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 19, 2025
9232258
Trying to fix with `useStrictTraceWrites == false`
AlexeyKuznetsov-DD Aug 19, 2025
2c0c4ce
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 19, 2025
118a0ef
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 19, 2025
d6ce19f
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 20, 2025
ba2a706
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 21, 2025
6f7706b
Trying to reproduce.
AlexeyKuznetsov-DD Aug 21, 2025
b8f1dd3
Rolled back `useStrictTraceWrites == false`
AlexeyKuznetsov-DD Aug 21, 2025
4429e5d
Refactored dump logic: start thread in advance and sleep.
AlexeyKuznetsov-DD Aug 21, 2025
ce809d7
Trying to reproduce
AlexeyKuznetsov-DD Aug 21, 2025
79204d9
Refactored thread dump logic
AlexeyKuznetsov-DD Aug 22, 2025
d777c3c
Refactored thread dump logic
AlexeyKuznetsov-DD Aug 22, 2025
dd2ea8c
Trying to reproduce
AlexeyKuznetsov-DD Aug 22, 2025
b0de3f5
Merge branch 'master' into alexeyk/debug-ci-freeze
AlexeyKuznetsov-DD Aug 22, 2025
bb06758
Attempt to get dump via gradle
AlexeyKuznetsov-DD Aug 22, 2025
556e780
Fixed codenarc.
AlexeyKuznetsov-DD Aug 22, 2025
f55ccb5
Trying to reproduce.
AlexeyKuznetsov-DD Aug 23, 2025
2d4aaa6
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Aug 23, 2025
f2ec317
Trying to reproduce.
AlexeyKuznetsov-DD Aug 23, 2025
161991a
Trying to reproduce with heap dump.
AlexeyKuznetsov-DD Aug 23, 2025
cd1c49c
Skip non-gradle heap dumps
AlexeyKuznetsov-DD Aug 23, 2025
331e308
Trying to reproduce.
AlexeyKuznetsov-DD Aug 23, 2025
a627099
Trying to reproduce.
AlexeyKuznetsov-DD Aug 25, 2025
4e2c0eb
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Aug 25, 2025
dbe7361
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Aug 25, 2025
255e66c
Trying to reproduce.
AlexeyKuznetsov-DD Aug 25, 2025
5ebc09c
Limit Heap dumps only for Gradle Test Executors.
AlexeyKuznetsov-DD Aug 25, 2025
e26f582
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Aug 26, 2025
19e5450
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Aug 27, 2025
714fdb9
Minor refactoring.
AlexeyKuznetsov-DD Aug 27, 2025
f382692
Minor refactoring.
AlexeyKuznetsov-DD Aug 27, 2025
be9dae2
Minor refactoring.
AlexeyKuznetsov-DD Aug 27, 2025
d920e92
Fixed typo
AlexeyKuznetsov-DD Aug 27, 2025
a927c0b
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Aug 29, 2025
70f5de0
Trying to reproduce freeze on CI.
AlexeyKuznetsov-DD Aug 30, 2025
fdfbadd
Trying to reproduce freeze on CI.
AlexeyKuznetsov-DD Aug 31, 2025
563ffce
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 2, 2025
27d30a6
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 3, 2025
7d7f3c1
Trying to reproduce freeze on CI.
AlexeyKuznetsov-DD Sep 3, 2025
068d9b4
Trying to reproduce freeze on CI.
AlexeyKuznetsov-DD Sep 3, 2025
82797f5
Trying to reproduce freeze on CI.
AlexeyKuznetsov-DD Sep 3, 2025
71ebf30
Trying to reproduce freeze on CI.
AlexeyKuznetsov-DD Sep 3, 2025
90bff07
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 4, 2025
62fe342
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 4, 2025
d69ee1c
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 4, 2025
a51977e
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 6, 2025
4f026d1
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 8, 2025
65dbc52
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 10, 2025
05bebd1
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 10, 2025
a426b8e
Moved dump logic to separate script. Refactored to be ready to merge …
AlexeyKuznetsov-DD Sep 10, 2025
3b64b91
Revert changes that should be applied as separate PR.
AlexeyKuznetsov-DD Sep 11, 2025
01960d3
Revert changes that should be applied as separate PR.
AlexeyKuznetsov-DD Sep 11, 2025
518d93f
Minor cleanup.
AlexeyKuznetsov-DD Sep 11, 2025
32a2665
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 11, 2025
27a9f4b
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 12, 2025
9fb4159
Merge branch 'master' into alexeyk/debug-ci-freeze-gradle
AlexeyKuznetsov-DD Sep 15, 2025
f61c7bc
Fixed review comments.
AlexeyKuznetsov-DD Sep 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gradle/configure_tests.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import java.time.Duration
import java.time.temporal.ChronoUnit

apply from: "$rootDir/gradle/dump_hanging_test.gradle"

def isTestingInstrumentation(Project project) {
return [
"junit-4.10",
Expand Down Expand Up @@ -128,7 +130,7 @@ if (!project.property("activePartition")) {
}
}

tasks.withType(Test) {
tasks.withType(Test).configureEach {
// https://docs.gradle.com/develocity/flaky-test-detection/
// https://docs.gradle.com/develocity/gradle-plugin/current/#test_retry
develocity.testRetry {
Expand Down
75 changes: 75 additions & 0 deletions gradle/dump_hanging_test.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit

// Schedule thread and heap dumps collection near test timeout.
tasks.withType(Test).configureEach { testTask ->
doFirst {
def scheduler = Executors.newSingleThreadScheduledExecutor({ r ->
Thread t = new Thread(r, 'dump-scheduler')
t.daemon = true
t
})

// Calculate delay for taking dumps as test timeout minus 2 minutes, but no less than 1 minute.
def delayMinutes = Math.max(1L, timeout.get().minusMinutes(2).toMinutes())

def future = scheduler.schedule({
try {
// Use Gradle's build dir and adjust for CI artifacts collection if needed.
def dumpDir = layout.buildDirectory.dir('dumps').map {
if (providers.environmentVariable("CI").isPresent()) {
// Move reports into the folder collected by the collect_reports.sh script.
new File(it.getAsFile().absolutePath.replace('dd-trace-java/dd-java-agent', 'dd-trace-java/workspace/dd-java-agent'))
} else {
it.asFile
}
}.get()

dumpDir.mkdirs()

// Collect PIDs of all Java processes.
def jvmProcesses = 'jcmd -l'.execute().text.readLines()

// Collect pids for 'Gradle test executors'.
def pids = jvmProcesses
.findAll({ it.contains('Gradle Test Executor') })
.collect({ it.substring(0, it.indexOf(' ')) })

pids.each { pid ->
logger.warn("Taking dumps for: ${testTask.getPath()}")

// Collect thread dump.
def threadDumpFile = new File(dumpDir, "${pid}-thread-dump-${System.currentTimeMillis()}.log")
new ProcessBuilder('jcmd', pid, 'Thread.print', '-l')
.redirectErrorStream(true)
.redirectOutput(threadDumpFile)
.start()
.waitFor()

// Collect heap dump.
def heapDumpFile = new File(dumpDir, "${pid}-heap-dump-${System.currentTimeMillis()}.hprof").absolutePath
def cmd = "jcmd ${pid} GC.heap_dump ${heapDumpFile}"
cmd.execute().waitFor()
}
} catch (Throwable e) {
logger.warn("Dumping failed: ${e.message}")
}
finally {
scheduler.shutdown()
}
}, delayMinutes, TimeUnit.MINUTES)

// Store handles for cancellation in doLast.
ext.dumpFuture = future
ext.dumpScheduler = scheduler
}

doLast {
// Cancel if the task finished before the scheduled dump.
try {
ext.dumpFuture?.cancel(false)
} finally {
ext.dumpScheduler?.shutdownNow()
}
}
}