File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
agent-bootstrap/src/main/java/datadog/trace/bootstrap
src/main/java/datadog/trace/bootstrap Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 6363import java .net .MalformedURLException ;
6464import java .net .URISyntaxException ;
6565import java .net .URL ;
66+ import java .nio .ByteBuffer ;
6667import java .security .CodeSource ;
6768import java .util .EnumSet ;
6869import java .util .concurrent .TimeUnit ;
@@ -183,7 +184,6 @@ public boolean isEnabledByDefault() {
183184 private static boolean codeOriginEnabled = false ;
184185 private static boolean distributedDebuggerEnabled = false ;
185186 private static boolean agentlessLogSubmissionEnabled = false ;
186-
187187 /**
188188 * Starts the agent; returns a boolean indicating if Agent started successfully
189189 *
@@ -795,6 +795,10 @@ private static void startCrashTracking() {
795795 if (forceEarlyStart ) {
796796 initializeCrashTrackingDefault ();
797797 } else {
798+ // To workaround JDK-8345810, we want to initialize nio early,
799+ // which has dependence on libpthread. Creating a small nio ByteBuffer
800+ // to force nio initialization.
801+ ByteBuffer buffer = ByteBuffer .allocate (1 );
798802 AgentTaskScheduler .get ().execute (Agent ::initializeCrashTrackingDefault );
799803 }
800804 } else {
Original file line number Diff line number Diff line change 44
55import datadog .trace .bootstrap .environment .EnvironmentVariables ;
66import datadog .trace .bootstrap .environment .JavaVirtualMachine ;
7+ import datadog .trace .bootstrap .environment .OperatingSystem ;
78import datadog .trace .bootstrap .environment .SystemProperties ;
89import de .thetaphi .forbiddenapis .SuppressForbidden ;
910import java .io .BufferedReader ;
@@ -61,7 +62,7 @@ public final class AgentBootstrap {
6162 // On Linux, libpthread must be loaded and initialized
6263 // while in single threaded mode.
6364 try {
64- if ("Linux" . equals ( System . getProperty ( "os.name" ) )) {
65+ if (OperatingSystem . isLinux ( )) {
6566 System .loadLibrary ("nio" );
6667 }
6768 } catch (Exception e ) {
You can’t perform that action at this time.
0 commit comments