peterxcli opened a new pull request, #8371:
URL: https://github.com/apache/ozone/pull/8371

   ## What changes were proposed in this pull request?
   
   The error
   ```java
   2025-04-24 16:22:54,652 [main] ERROR utils.MetricsUtil 
(MetricsUtil.java:updateAnnotation(97)) - Update Metrics annotation failed. 
   java.lang.reflect.InaccessibleObjectException: Unable to make private 
java.lang.Class$AnnotationData java.lang.Class.annotationData() accessible: 
module java.base does not "opens java.lang" to unnamed module @2c7b84de
   ```
   keeps appearing in test log
   
   And the root cause and solution can be found from 
https://stackoverflow.com/a/41265267
   >The exception is caused by the [Java Platform Module 
System](http://openjdk.java.net/projects/jigsaw/spec/sotms) that was introduced 
in Java 9, particularly its implementation of strong encapsulation. It only 
allows 
[access](http://openjdk.java.net/projects/jigsaw/spec/sotms/#accessibility) 
under certain conditions, 
   > - the most prominent ones are: the type has to be public
   > - the owning package has to be exported
   
   And I had tried add some argument from the suggestion:
   ```bash
   # --add-opens has the following syntax: {A}/{package}={B}
   java --add-opens java.base/java.lang=ALL-UNNAMED
   ```
   
   But the exception still appear in the test log, I think it might also not a 
good long term solution. So I created a common metrics class for those two type 
of event related thread executor. Removing the metrics code from them and the 
metrics also support customize name for every of its instance.
   
   
   ### Check that exception log is gone
   
   Ran some example test
   ```bash
   mvn test -pl hadoop-ozone/integration-test 
"-Dtest=TestValidateBCSIDOnRestart#testValidateBCSIDOnDnRestart"
   ```
   
   test output:
   
   
[org.apache.hadoop.ozone.client.rpc.TestValidateBCSIDOnRestart-output.txt](https://github.com/user-attachments/files/19984184/org.apache.hadoop.ozone.client.rpc.TestValidateBCSIDOnRestart-output.txt)
   
   
   ### Metrics name correctness
   
   ```bash
   ozone freon stb --scm-host=scm --benchmark=AllocateBlocks
   ```
   
![image](https://github.com/user-attachments/assets/c1010278-cb4b-4d79-983d-bf4e623b2392)
   
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-12901
   
   ## How was this patch tested?
   
   CI:
   https://github.com/peterxcli/ozone/actions/runs/14763747318


-- 
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