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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to