|
61 | 61 | import datadog.trace.bootstrap.instrumentation.jfr.InstrumentationBasedProfiling; |
62 | 62 | import datadog.trace.util.AgentTaskScheduler; |
63 | 63 | import datadog.trace.util.AgentThreadFactory.AgentThread; |
64 | | -import datadog.trace.util.JDK9ModuleAccess; |
65 | 64 | import datadog.trace.util.throwable.FatalAgentMisconfigurationError; |
66 | 65 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
67 | 66 | import java.lang.instrument.Instrumentation; |
@@ -670,8 +669,6 @@ public InstallDatadogTracerCallback( |
670 | 669 | } |
671 | 670 |
|
672 | 671 | installDatadogMeter(initTelemetry); |
673 | | - // Must run before installDatadogTracer, which triggers the ddprof profiler load. |
674 | | - prepareDatadogProfilerContextStorage(instrumentation); |
675 | 672 | installDatadogTracer(initTelemetry, scoClass, sco); |
676 | 673 | maybeInstallLogsIntake(scoClass, sco); |
677 | 674 | maybeStartIast(instrumentation); |
@@ -1488,33 +1485,6 @@ public void withTracer(TracerAPI tracer) { |
1488 | 1485 | }); |
1489 | 1486 | } |
1490 | 1487 |
|
1491 | | - /** |
1492 | | - * Exports {@code jdk.internal.misc} to the classloader that loads {@code |
1493 | | - * com.datadoghq.profiler.*} before the Datadog profiler is loaded. |
1494 | | - * |
1495 | | - * <p>On JDK 21+, the profiler scopes its context {@code ThreadContext} storage to the carrier |
1496 | | - * thread using {@code jdk.internal.misc.CarrierThreadLocal}, so a mounted virtual thread resolves |
1497 | | - * to its current carrier's record — fixing a virtual-thread context use-after-free. That type |
1498 | | - * lives in a non-exported package, hence the export. Must run before {@code |
1499 | | - * installDatadogTracer}, which loads the profiler via {@link |
1500 | | - * #createProfilingContextIntegration()}. |
1501 | | - */ |
1502 | | - private static void prepareDatadogProfilerContextStorage(Instrumentation inst) { |
1503 | | - try { |
1504 | | - if (inst == null |
1505 | | - || !Config.get().isProfilingEnabled() |
1506 | | - || !Config.get().isDatadogProfilerEnabled() |
1507 | | - || OperatingSystem.isWindows() |
1508 | | - || !isJavaVersionAtLeast(21)) { |
1509 | | - return; |
1510 | | - } |
1511 | | - JDK9ModuleAccess.exportModuleToUnnamedModule( |
1512 | | - inst, "java.base", new String[] {"jdk.internal.misc"}, AGENT_CLASSLOADER); |
1513 | | - } catch (Throwable t) { |
1514 | | - log.debug("Unable to export jdk.internal.misc for the Datadog profiler", t); |
1515 | | - } |
1516 | | - } |
1517 | | - |
1518 | 1488 | /** |
1519 | 1489 | * {@see com.datadog.profiling.ddprof.DatadogProfilingIntegration} must not be modified to depend |
1520 | 1490 | * on JFR. |
|
0 commit comments