Skip to content
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e858d8e
Attempt to debug CI flaky timeout. DO NOT MERGE!
AlexeyKuznetsov-DD Jul 25, 2025
2ec7817
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Jul 25, 2025
2a53ed6
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Jul 26, 2025
99bf38c
Attempt to collect thread dump.
AlexeyKuznetsov-DD Jul 28, 2025
1e09bdf
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Jul 28, 2025
057d106
Attempt to collect thread dump.
AlexeyKuznetsov-DD Jul 28, 2025
d338595
Attempt to collect thread dump.
AlexeyKuznetsov-DD Jul 28, 2025
cb5002a
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Jul 29, 2025
119f529
Another attempt.
AlexeyKuznetsov-DD Jul 29, 2025
6f55eed
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Jul 29, 2025
bbe67ef
Another attempt.
AlexeyKuznetsov-DD Jul 29, 2025
3b1a643
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Jul 30, 2025
9e8a13e
Attempt to specify full path
AlexeyKuznetsov-DD Jul 30, 2025
88dcfa3
Attempt to specify full path
AlexeyKuznetsov-DD Jul 30, 2025
9d9f161
Cleanup
AlexeyKuznetsov-DD Jul 31, 2025
5296e75
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Jul 31, 2025
8429062
One more try
AlexeyKuznetsov-DD Jul 31, 2025
12703ea
Merge remote-tracking branch 'origin/alexeyk/debug-ci-timeout' into a…
AlexeyKuznetsov-DD Jul 31, 2025
1a8a272
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Jul 31, 2025
cd0ad30
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 1, 2025
d58d75b
Added test info to dump.
AlexeyKuznetsov-DD Aug 1, 2025
9deb033
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 3, 2025
1f22349
One more try
AlexeyKuznetsov-DD Aug 3, 2025
8d42824
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 4, 2025
8539c89
Try to fix test freeze by updating logback version.
AlexeyKuznetsov-DD Aug 4, 2025
b0fa34b
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 4, 2025
e186248
Try to fix test freeze by updating logback version to 1.2.9.
AlexeyKuznetsov-DD Aug 4, 2025
b44cf56
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 5, 2025
ffa412c
Added heap dump
AlexeyKuznetsov-DD Aug 5, 2025
8ddf5dc
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 5, 2025
48e34d7
Fixed report script
AlexeyKuznetsov-DD Aug 5, 2025
c3bdd3e
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 5, 2025
892be19
Another attempt.
AlexeyKuznetsov-DD Aug 5, 2025
2844c00
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 5, 2025
7518114
Another attempt.
AlexeyKuznetsov-DD Aug 5, 2025
ab90b23
Another attempt.
AlexeyKuznetsov-DD Aug 5, 2025
7bda4d4
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 6, 2025
f0cd3d4
Another attempt 3.
AlexeyKuznetsov-DD Aug 6, 2025
901b3a3
Spock 2.4
AlexeyKuznetsov-DD Aug 6, 2025
d0916a9
Merge branch 'master' into alexeyk/debug-ci-timeout
AlexeyKuznetsov-DD Aug 6, 2025
9bf1b6b
Update Spock only for one module.
AlexeyKuznetsov-DD Aug 6, 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
1 change: 1 addition & 0 deletions .gitlab/collect_reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function process_reports () {
cp -r workspace/$project_to_save/build/reports/* $report_path/ 2>/dev/null || true
cp workspace/$project_to_save/build/hs_err_pid*.log $report_path/ 2>/dev/null || true
cp workspace/$project_to_save/build/javacore*.txt $report_path/ 2>/dev/null || true
cp workspace/$project_to_save/build/thread-dump-*.log $report_path/ 2>/dev/null || true
fi
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,61 @@ import datadog.trace.agent.test.AgentTestRunner
import datadog.trace.api.Trace

import java.util.concurrent.Callable
import java.util.concurrent.Executors
import java.util.concurrent.ScheduledExecutorService
import java.util.concurrent.ScheduledFuture
import java.util.concurrent.StructuredTaskScope
import java.util.concurrent.TimeUnit

import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
import static datadog.trace.agent.test.utils.TraceUtils.runnableUnderTrace
import static java.time.Instant.now

class StructuredConcurrencyTest extends AgentTestRunner {
ScheduledExecutorService scheduler
ScheduledFuture<?> threadDumpTask

def setup() {
scheduler = Executors.newSingleThreadScheduledExecutor()

threadDumpTask = scheduler.scheduleAtFixedRate({
File reportDir = new File("build")
println("DEBUG: " + reportDir.absolutePath)

if (!reportDir.exists()) {
println("build folder not found")
return
}

// Define the file path
File reportFile = new File(reportDir, String.format("thread-dump-%d.log", System.currentTimeMillis()))

// Write to the file
try (FileWriter writer = new FileWriter(reportFile)) {
def s = "=== Thread Dump Triggered at ${new Date()} ===\n"
println(s)
writer.write(s)
Thread.getAllStackTraces().each { thread, stack ->
def t = "Thread: ${thread.name}, daemon: ${thread.daemon}\n"
println(t)
writer.write(t)
stack.each {
def st = "\tat ${it}\n"
println(st)
writer.write(st)
}
}
writer.write("==============================================\n")
}
}, 10, 60_000, TimeUnit.MILLISECONDS)
}

def cleanup() {
threadDumpTask?.cancel(false)
scheduler?.shutdownNow()
}


/**
* Tests the structured task scope with a single task.
*/
Expand All @@ -18,14 +66,15 @@ class StructuredConcurrencyTest extends AgentTestRunner {
def result = false

when:
Thread.sleep(100)
runUnderTrace("parent") {
def task = taskScope.fork(new Callable<Boolean>() {
@Trace(operationName = "child")
@Override
Boolean call() throws Exception {
return true
}
})
@Trace(operationName = "child")
@Override
Boolean call() throws Exception {
return true
}
})
taskScope.joinUntil(now() + 10) // Wait for 10 seconds at maximum
result = task.get()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import datadog.trace.agent.test.utils.PortUtils
import redis.embedded.RedisServer
import spock.lang.Shared

import java.util.concurrent.Executors
import java.util.concurrent.ScheduledExecutorService
import java.util.concurrent.ScheduledFuture
import java.util.concurrent.TimeUnit

import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace

abstract class Lettuce4ClientTestBase extends VersionedNamingTestBase {
Expand All @@ -32,6 +37,9 @@ abstract class Lettuce4ClientTestBase extends VersionedNamingTestBase {
@Shared
RedisServer redisServer

ScheduledExecutorService scheduler
ScheduledFuture<?> threadDumpTask

@Shared
Map<String, String> testHashMap = [
firstname: "John",
Expand All @@ -53,14 +61,47 @@ abstract class Lettuce4ClientTestBase extends VersionedNamingTestBase {
embeddedDbUri = "redis://" + dbAddr

redisServer = RedisServer.newRedisServer()
// bind to localhost to avoid firewall popup
.setting("bind " + HOST)
// set max memory to avoid problems in CI
.setting("maxmemory 128M")
.port(port).build()
// bind to localhost to avoid firewall popup
.setting("bind " + HOST)
// set max memory to avoid problems in CI
.setting("maxmemory 128M")
.port(port).build()
}

def setup() {
scheduler = Executors.newSingleThreadScheduledExecutor()

threadDumpTask = scheduler.scheduleAtFixedRate({
File reportDir = new File("build")
println("DEBUG: " + reportDir.absolutePath)

if (!reportDir.exists()) {
println("build folder not found")
return
}

// Define the file path
File reportFile = new File(reportDir, String.format("thread-dump-%d.log", System.currentTimeMillis()))

// Write to the file
try (FileWriter writer = new FileWriter(reportFile)) {
def s = "=== Thread Dump Triggered at ${new Date()} ===\n"
println(s)
writer.write(s)
Thread.getAllStackTraces().each { thread, stack ->
def t = "Thread: ${thread.name}, daemon: ${thread.daemon}\n"
println(t)
writer.write(t)
stack.each {
def st = "\tat ${it}\n"
println(st)
writer.write(st)
}
}
writer.write("==============================================\n")
}
}, 10, 60_000, TimeUnit.MILLISECONDS)

redisServer.start()

redisClient = RedisClient.create(embeddedDbUri)
Expand All @@ -79,6 +120,9 @@ abstract class Lettuce4ClientTestBase extends VersionedNamingTestBase {
}

def cleanup() {
threadDumpTask?.cancel(false)
scheduler?.shutdownNow()

connection.close()
redisClient.shutdown()
redisServer.stop()
Expand Down
Loading