Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.agent.tooling.InstrumenterModule;
import datadog.trace.bootstrap.CallDepthThreadLocalMap;
import datadog.trace.bootstrap.instrumentation.java.concurrent.NewTaskForPlaceholder;
import datadog.trace.bootstrap.instrumentation.java.concurrent.Wrapper;
import java.util.concurrent.AbstractExecutorService;
Expand Down Expand Up @@ -97,7 +98,16 @@ public static void cancel(
@Advice.Thrown Throwable error) {
// don't cancel unless we did the wrapping
if (wrapped && null != error && task instanceof RunnableFuture) {
((RunnableFuture) task).cancel(true);
// Guard against recursive cancel calls which can cause StackOverflowError
// when executor.execute() fails during shutdown and triggers promise notifications
int callDepth = CallDepthThreadLocalMap.incrementCallDepth(RunnableFuture.class);
try {
if (callDepth == 0) {
((RunnableFuture) task).cancel(true);
}
} finally {
CallDepthThreadLocalMap.decrementCallDepth(RunnableFuture.class);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
apply from: "$rootDir/gradle/java.gradle"
// Use slf4j-simple as default; logback has a high chance of getting stuck in a deadlock on CI.
apply from: "$rootDir/gradle/slf4j-simple.gradle"

testJvmConstraints {
// TODO Java 17: This version of vertx-web doesn't support Java 17
Expand Down