Skip to content
Merged
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 datadog.trace.bootstrap.FieldBackedContextAccessor;
import datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter;
import datadog.trace.util.AgentTaskScheduler;
import de.thetaphi.forbiddenapis.SuppressForbidden;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.Instrumentation;
import java.util.Collections;
Expand Down Expand Up @@ -43,6 +44,17 @@ public class AgentInstaller {
addByteBuddyRawSetting();
// register weak map supplier as early as possible
WeakMaps.registerAsSupplier();
circularityErrorWorkaround();
}

@SuppressForbidden
private static void circularityErrorWorkaround() {
// these classes have been involved in intermittent ClassCircularityErrors during startup
// they don't need context storage, so it's safe to load them before installing the agent
try {
Class.forName("java.util.concurrent.ThreadLocalRandom");
} catch (Throwable ignore) {
}
}

public static void installBytebuddyAgent(final Instrumentation inst) {
Expand Down