You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "prathmesh12-coder (via GitHub)" <gi...@apache.org> on 2026/07/20 07:37:32 UTC

[PR] HDDS-15868. Enable dynamic agent loading for tests [ozone]

prathmesh12-coder opened a new pull request, #10816:
URL: https://github.com/apache/ozone/pull/10816

   ## What changes were proposed in this pull request?
   - In JDK 21, the JVM still allows dynamic agent loading, but emits a warning :
   ```
   WARNING: A Java agent has been loaded dynamically (file:/u/bob/agent.jar)
   WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
   WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
   WARNING: Dynamic loading of agents will be disallowed by default in a future release
   ```
   - In a future JDK release, dynamic agent loading will be disallowed by default. see ([JEP 451](https://openjdk.org/jeps/451#:~:text=Description,agent%20are%20unaffected%20by%20these%20changes.))
   - In future release, dynamically loading an agent without `-XX:+EnableDynamicAgentLoading` may cause an exception to be thrown:
   
   ```
   com.sun.tools.attach.AgentLoadException: Failed to load agent library: 
   Dynamic agent loading is not enabled. Use -XX:+EnableDynamicAgentLoading 
   to launch target VM.
   ```
   - Ozone unit tests use Mockito inline (mock-maker-inline), which causes ByteBuddy to dynamically attach its agent during Surefire runs. That triggers these warnings on JDK 21+
   - Added `-XX:+EnableDynamicAgentLoading` to `maven-surefire-plugin.argLine` in the root `pom.xml` which suppresses the JDK 21+ dynamic-agent warnings
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15868 
   
   ## How was this patch tested?
   - Manually tested :
     - reproduced : 
       ```
       mvn -pl :hdds-container-service test -Dtest=TestStorageVolumeChecker -DskipShade -DskipRecon -DskipDocs
       ```
      - `.../surefire-reports/*TestStorageVolumeChecker-output.txt` contained dynamic-agent warnings shown above
      
         ```
         psapate@CWJC2KR9DP ozone % grep -A3 "Java agent has been loaded dynamically" hadoop-hdds/container-service/target/surefire-reports/*TestStorageVolumeChecker-output.txt
         
         WARNING: A Java agent has been loaded dynamically (/Users/psapate/.m2/repository/net/bytebuddy/byte-buddy-agent/1.18.11/byte-buddy-agent-1.18.11.jar)
         WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
         WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
         WARNING: Dynamic loading of agents will be disallowed by default in a future release
         ```
       - after adding the `-XX:+EnableDynamicAgentLoading` to `maven-surefire-plugin.argLine` in the root pom.xml same command no longer emits those warnings and all 20 tests pass.
       
         ```
         psapate@CWJC2KR9DP ozone % grep -A3 "Java agent has been loaded dynamically" hadoop-hdds/container-service/target/surefire-reports/*TestStorageVolumeChecker-output.txt
         ```
    - CI success : https://github.com/prathmesh12-coder/ozone/actions/runs/29682107246 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15868. Enable dynamic agent loading for tests [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #10816:
URL: https://github.com/apache/ozone/pull/10816#issuecomment-5091796167

   Thanks @prathmesh12-coder for the patch, @smengcl for the review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15868. Enable dynamic agent loading for tests [ozone]

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10816:
URL: https://github.com/apache/ozone/pull/10816#discussion_r3643966011


##########
pom.xml:
##########
@@ -147,7 +147,7 @@
     <maven-shade-plugin.version>3.6.2</maven-shade-plugin.version>
     <maven-site-plugin.version>3.22.0</maven-site-plugin.version>
     <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
-    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError</maven-surefire-plugin.argLine>
+    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLine>

Review Comment:
   This property is inherited by every Surefire fork, but JDK 8 does not recognize `-XX:+EnableDynamicAgentLoading`. Running the test command from the PR on this head with JDK 8 fails before executing any tests (`Unrecognized VM option 'EnableDynamicAgentLoading'`).
   
   Ozone still documents JDK 8 support and includes it in the CI compile matrix. Could we enable this argument only from a JDK `[11,)` profile? Something like:
   
   ```diff
   diff --git a/pom.xml b/pom.xml
   index 9eb51b2f548..xxxxxxxxxxx 100644
   --- a/pom.xml
   +++ b/pom.xml
   @@ -147,8 +147,9 @@
        <maven-shade-plugin.version>3.6.2</maven-shade-plugin.version>
        <maven-site-plugin.version>3.22.0</maven-site-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
   -    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLine>
   +    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError ${maven-surefire-plugin.argLineDynamicAgentLoading}</maven-surefire-plugin.argLine>
        <maven-surefire-plugin.argLineAccessArgs />
   +    <maven-surefire-plugin.argLineDynamicAgentLoading />
        <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
        <maven-surefire-report-plugin.version>${maven-surefire-plugin.version}</maven-surefire-report-plugin.version>
        <maven.compiler.createMissingPackageInfoClass>false</maven.compiler.createMissingPackageInfoClass>
   @@ -2697,6 +2698,9 @@
          <activation>
            <jdk>[11,]</jdk>
          </activation>
   +      <properties>
   +        <maven-surefire-plugin.argLineDynamicAgentLoading>-XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLineDynamicAgentLoading>
   +      </properties>
          <build>
            <plugins>
              <plugin>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15868. Enable dynamic agent loading for tests [ozone]

Posted by "prathmesh12-coder (via GitHub)" <gi...@apache.org>.
prathmesh12-coder commented on code in PR #10816:
URL: https://github.com/apache/ozone/pull/10816#discussion_r3644448322


##########
pom.xml:
##########
@@ -147,7 +147,7 @@
     <maven-shade-plugin.version>3.6.2</maven-shade-plugin.version>
     <maven-site-plugin.version>3.22.0</maven-site-plugin.version>
     <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
-    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError</maven-surefire-plugin.argLine>
+    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLine>

Review Comment:
   Thanks @smengcl for review and suggestion !!
   enabled dynamic agent loading from JDK [11,) .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15868. Enable dynamic agent loading for tests [ozone]

Posted by "prathmesh12-coder (via GitHub)" <gi...@apache.org>.
prathmesh12-coder commented on code in PR #10816:
URL: https://github.com/apache/ozone/pull/10816#discussion_r3656518356


##########
pom.xml:
##########
@@ -147,7 +147,7 @@
     <maven-shade-plugin.version>3.6.2</maven-shade-plugin.version>
     <maven-site-plugin.version>3.22.0</maven-site-plugin.version>
     <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
-    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError</maven-surefire-plugin.argLine>
+    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLine>

Review Comment:
   Thanks @adoroszlai , done.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15868. Enable dynamic agent loading for tests [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #10816:
URL: https://github.com/apache/ozone/pull/10816


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15868. Enable dynamic agent loading for tests [ozone]

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10816:
URL: https://github.com/apache/ozone/pull/10816#discussion_r3643966011


##########
pom.xml:
##########
@@ -147,7 +147,7 @@
     <maven-shade-plugin.version>3.6.2</maven-shade-plugin.version>
     <maven-site-plugin.version>3.22.0</maven-site-plugin.version>
     <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
-    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError</maven-surefire-plugin.argLine>
+    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLine>

Review Comment:
   This property is inherited by every Surefire fork, but JDK 8 does not recognize `-XX:+EnableDynamicAgentLoading`. Running the test command from the PR on this head with JDK 8 fails before executing any tests (`Unrecognized VM option 'EnableDynamicAgentLoading'`).
   
   Ozone still documents JDK 8 support and includes it in the CI compile matrix. Could we enable this argument only from a JDK `[21,)` profile? Something like:
   
   ```diff
   diff --git a/pom.xml b/pom.xml
   index 9eb51b2f548..xxxxxxxxxxx 100644
   --- a/pom.xml
   +++ b/pom.xml
   @@ -147,8 +147,9 @@
        <maven-shade-plugin.version>3.6.2</maven-shade-plugin.version>
        <maven-site-plugin.version>3.22.0</maven-site-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
   -    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLine>
   +    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError ${maven-surefire-plugin.argLineDynamicAgentLoading}</maven-surefire-plugin.argLine>
        <maven-surefire-plugin.argLineAccessArgs />
   +    <maven-surefire-plugin.argLineDynamicAgentLoading />
        <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
        <maven-surefire-report-plugin.version>${maven-surefire-plugin.version}</maven-surefire-report-plugin.version>
        <maven.compiler.createMissingPackageInfoClass>false</maven.compiler.createMissingPackageInfoClass>
   @@ -2697,6 +2698,9 @@
          <activation>
            <jdk>[11,]</jdk>
          </activation>
   +      <properties>
   +        <maven-surefire-plugin.argLineDynamicAgentLoading>-XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLineDynamicAgentLoading>
   +      </properties>
          <build>
            <plugins>
              <plugin>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15868. Enable dynamic agent loading for tests [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #10816:
URL: https://github.com/apache/ozone/pull/10816#discussion_r3650458385


##########
pom.xml:
##########
@@ -147,7 +147,7 @@
     <maven-shade-plugin.version>3.6.2</maven-shade-plugin.version>
     <maven-site-plugin.version>3.22.0</maven-site-plugin.version>
     <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
-    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError</maven-surefire-plugin.argLine>
+    <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLine>

Review Comment:
   I'd prefer adding `-XX:+IgnoreUnrecognizedVMOptions` instead of splitting to a profile.
   
   ```xml
       <maven-surefire-plugin.argLine>-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -XX:+IgnoreUnrecognizedVMOptions -XX:+EnableDynamicAgentLoading</maven-surefire-plugin.argLine>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org