Skip to content

Commit c96d579

Browse files
committed
Force loading/initializing pthread early on main thread
1 parent 51dcb98 commit c96d579

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,12 @@ public static void start(
291291
startCwsAgent();
292292
}
293293

294+
// To workaround JDK-8345810, we want to trigger loading/initializing of pthread library on
295+
// main thread (Linux only)
296+
if (OperatingSystem.isLinux()) {
297+
FileSystems.getDefault();
298+
}
299+
294300
/*
295301
* Force the task scheduler init early. The exception profiling instrumentation may get in way of the initialization
296302
* when it will happen after the class transformers were added.
@@ -796,10 +802,6 @@ private static void startCrashTracking() {
796802
if (forceEarlyStart) {
797803
initializeCrashTrackingDefault();
798804
} else {
799-
// To workaround JDK-8345810, we want to initialize nio early,
800-
// which has dependence on libpthread. Creating a small nio ByteBuffer
801-
// to force nio initialization.
802-
FileSystems.getDefault();
803805
AgentTaskScheduler.get().execute(Agent::initializeCrashTrackingDefault);
804806
}
805807
} else {

0 commit comments

Comments
 (0)