openj9 icon indicating copy to clipboard operation
openj9 copied to clipboard

Add CRaCMXBean API

Open singh264 opened this issue 1 year ago • 15 comments

Add CRaCMXBean API to get the restore time and the uptime since restore.

Issue: https://github.com/eclipse-openj9/openj9/issues/18842 Signed-off-by: Amarpreet Singh [email protected]

singh264 avatar Jan 30 '24 16:01 singh264

@tajila requesting your review.

singh264 avatar Feb 02 '24 16:02 singh264

@ChengJin01 Please review these changes

tajila avatar Feb 09 '24 13:02 tajila

@ChengJin01 re-requesting your review.

singh264 avatar Feb 09 '24 16:02 singh264

@tajila re-requesting your review.

singh264 avatar Feb 12 '24 15:02 singh264

jenkins test sanity plinux jdk21

tajila avatar Feb 12 '24 15:02 tajila

@tajila how can the JLM_Tests build fail in jenkins despite it passing locally on a x86-64 linux machine?

Local build:

// make compile (in TKG)

...
build:

init:
...

getDependentLibs:
...

compile:
     [echo] Ant version is Apache Ant(TM) version 1.10.7 compiled on October 24 2019
     [echo] ============COMPILER SETTINGS============
     [echo] ===fork:                         yes
     [echo] ===executable:                   /root/openj9_issues_18842/openj9-openjdk-jdk21/build/linux-x86_64-server-release/images/jdk/bin/javac
     [echo] ===debug:                        on
     [echo] ===destdir:                      /root/openj9_issues_18842/openj9-openjdk-jdk21/openj9/test/functional/JLM_Tests/bin
    [javac] Compiling 68 source files to /root/openj9_issues_18842/openj9-openjdk-jdk21/openj9/test/functional/JLM_Tests/bin
    [javac] /root/openj9_issues_18842/openj9-openjdk-jdk21/openj9/test/functional/JLM_Tests/src/j9vm/test/softmx/SoftmxRemoteTest.java:262: warning: [removal] stop() in Thread has been deprecated and marked for removal
    [javac]             inMonitor.stop();
    [javac]                      ^
    [javac] /root/openj9_issues_18842/openj9-openjdk-jdk21/openj9/test/functional/JLM_Tests/src/j9vm/test/softmx/SoftmxRemoteTest.java:263: warning: [removal] stop() in Thread has been deprecated and marked for removal
    [javac]             errorMonitor.stop();
    [javac]                         ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 2 warnings
    [javac] Creating empty /root/openj9_issues_18842/openj9-openjdk-jdk21/openj9/test/functional/JLM_Tests/bin/org/openj9/test/util/package-info.class

dist:
...

clean:
...


BUILD SUCCESSFUL
Total time: 7 minutes 18 seconds
0

Jenkins build:

...
12:51:53  build:
12:51:53  
12:51:53  init:
          ...
12:51:53  
12:51:53  getDependentLibs:
          ...
12:51:53  
12:51:53  compile:
12:51:53       [echo] Ant version is Apache Ant(TM) version 1.10.5 compiled on July 10 2018
12:51:53       [echo] ============COMPILER SETTINGS============
12:51:53       [echo] ===fork:                         yes
12:51:53       [echo] ===executable:                   /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/jdkbinary/j2sdk-image/bin/javac
12:51:53       [echo] ===debug:                        on
12:51:53       [echo] ===destdir:                      /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/bin
12:51:53      [javac] Compiling 68 source files to /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/bin
12:51:56      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:35: error: package jdk.crac.management does not exist
12:51:56      [javac]   private final static jdk.crac.management.CRaCMXBean cracMXBean = jdk.crac.management.CRaCMXBean.getCRaCMXBean();
12:51:56      [javac]                                           ^
12:51:57      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:72: error: package jdk.crac.management does not exist
12:51:57      [javac]   private static class TestCRaCMXBeanImpl implements jdk.crac.management.CRaCMXBean {
12:51:57      [javac]                                                                         ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/j9vm/test/softmx/SoftmxRemoteTest.java:262: warning: [removal] stop() in Thread has been deprecated and marked for removal
12:51:58      [javac]       inMonitor.stop();
12:51:58      [javac]                ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/j9vm/test/softmx/SoftmxRemoteTest.java:263: warning: [removal] stop() in Thread has been deprecated and marked for removal
12:51:58      [javac]       errorMonitor.stop();
12:51:58      [javac]                   ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:35: error: package jdk.crac.management does not exist
12:51:58      [javac]   private final static jdk.crac.management.CRaCMXBean cracMXBean = jdk.crac.management.CRaCMXBean.getCRaCMXBean();
12:51:58      [javac]                                                                                       ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:49: error: package jdk.crac.management does not exist
12:51:58      [javac]       Assert.assertNotNull(jdk.crac.management.CRaCMXBean.getCRaCMXBean(), "CRaCMXBean.getCRaCMXBean() is null");
12:51:58      [javac]                                               ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:56: error: package jdk.crac.management does not exist
12:51:58      [javac]           jdk.crac.management.CRaCMXBean.CRAC_MXBEAN_NAME,
12:51:58      [javac]                              ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:64: error: package jdk.crac.management does not exist
12:51:58      [javac]       jdk.crac.management.CRaCMXBean testCRaCMXBean = new TestCRaCMXBeanImpl(malformedCRaCMXBeanName);
12:51:58      [javac]                          ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:79: error: method does not override or implement a method from a supertype
12:51:58      [javac]       @Override
12:51:58      [javac]       ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:84: error: method does not override or implement a method from a supertype
12:51:58      [javac]       @Override
12:51:58      [javac]       ^
12:51:58      [javac] /home/jenkins/jenkins-agent/workspace/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal_testList_0/aqa-tests/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestCRaCMXBean.java:89: error: method does not override or implement a method from a supertype
12:51:58      [javac]       @Override
12:51:58      [javac]       ^
12:51:59      [javac] Note: Some input files use or override a deprecated API.
12:51:59      [javac] Note: Recompile with -Xlint:deprecation for details.
12:51:59      [javac] Note: Some input files use unchecked or unsafe operations.
12:51:59      [javac] Note: Recompile with -Xlint:unchecked for details.
12:51:59      [javac] 9 errors
12:51:59      [javac] 2 warnings
12:52:00  
12:52:00  BUILD FAILED
...

singh264 avatar Feb 12 '24 20:02 singh264

@tajila how can the JLM_Tests build fail in jenkins despite it passing locally on a x86-64 linux machine?

@JasonFengJ9 changes may have affected this

tajila avatar Feb 12 '24 20:02 tajila

how can the JLM_Tests build fail in jenkins despite it passing locally on a x86-64 linux machine?

Failed at https://openj9-jenkins.osuosl.org/job/Test_openjdk21_j9_sanity.functional_ppc64le_linux_Personal/67/console

This is because CRAC_SUPPORT is only enabled by default at Linux x64 platform. The test should be guarded like https://github.com/eclipse-openj9/openj9/blob/8a30e5ff110ebd42ceda50469b4cf2c21366d7c8/test/functional/cmdLineTests/criu/playlist.xml#L159

https://github.com/eclipse-openj9/openj9/blob/8a30e5ff110ebd42ceda50469b4cf2c21366d7c8/test/functional/cmdLineTests/criu/build.xml#L65-L69

In addition, I think exports jdk.crac.management; will break some internal compliance tests. I am working on an PR to add similar exports programmatically when the CRaC is enabled.

JasonFengJ9 avatar Feb 12 '24 20:02 JasonFengJ9

This is because CRAC_SUPPORT is only enabled by default at Linux x64 platform.

Would it be incorrect to enable CRAC_SUPPORT by default on x86-64 linux, ppc64le linux, aarch64 linux and s390x linux to match CRIU_SUPPORT? The code would be adjusted in jdk11, jdk17, jdk21, jdk-next and tkg.

The test should be guarded like

<feature>CRAC:required</feature>

<not> <contains string="${TEST_FLAG}" substring="CRAC" /> </not> <then> <property name="excludeTestJDKCRAC" value="org/openj9/criu/TestJDKCRAC.java" />

I added the guards for TestCRaCMXBean to enable it by default only on x86-64 linux.

I think exports jdk.crac.management; will break some internal compliance tests. I am working on an PR to add similar exports programmatically when the CRaC is enabled.

Would this PR be merged after your PR to avoid breaking the internal compliance tests?

singh264 avatar Feb 13 '24 22:02 singh264

This is because CRAC_SUPPORT is only enabled by default at Linux x64 platform.

Would it be incorrect to enable CRAC_SUPPORT by default on x86-64 linux, ppc64le linux, aarch64 linux and s390x linux to match CRIU_SUPPORT? The code would be adjusted in jdk11, jdk17, jdk21, jdk-next and tkg.

CRaC support doesn't match CRIU always, currently CRAC_SUPPORT is only enabled by default at Linux x64 platform. @tajila do we want to enable CRaC for other platforms as well?

I think exports jdk.crac.management; will break some internal compliance tests. I am working on an PR to add similar exports programmatically when the CRaC is enabled.

Would this PR be merged after your PR to avoid breaking the internal compliance tests?

It could be either way, if this is merged first, I can fix this exports assuming it breaks the compliance tests, otherwise, this PR can adopt my helper method (expect to open a PR the next day or so).

JasonFengJ9 avatar Feb 13 '24 22:02 JasonFengJ9

@tajila do we want to enable CRaC for other platforms as well?

Just x64 for now

tajila avatar Feb 14 '24 14:02 tajila

I am investigating JLM_Tests failures when TestCRaCMXBean is excluded from compilation on platforms where CRAC_SUPPORT is not enabled by default. A x86-64 linux build passed, but a ppc64le linux build failed due to:

TESTING:
JVMSHRC023E Cache does not exist
[TestNG] [ERROR] 
Cannot find class in classpath: org.openj9.test.java.lang.management.TestCRaCMXBean
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.testng.internal.ExitCodeListener.hasTests()" because "this.exitCodeListener" is null
	at org.testng.TestNG.getStatus(TestNG.java:211)
	at org.testng.TestNG.main(TestNG.java:1324)

singh264 avatar Feb 15 '24 15:02 singh264

I am investigating JLM_Tests failures when TestCRaCMXBean is excluded from compilation on platforms where CRAC_SUPPORT is not enabled by default.

[TestNG] [ERROR] Cannot find class in classpath: org.openj9.test.java.lang.management.TestCRaCMXBean

The JLM_Tests failures on platforms where CRAC_SUPPORT is not enabled by default was fixed by excluding TestCRaCMXBean during the compilation and the generation of distribution of JLM_Tests in build.xml.

singh264 avatar Feb 16 '24 16:02 singh264

@singh264 Is this ready to go now?

tajila avatar Feb 20 '24 14:02 tajila

@singh264 Is this ready to go now?

Yes.

singh264 avatar Feb 20 '24 14:02 singh264

jenkins test sanity plinux jdk17

tajila avatar Feb 20 '24 17:02 tajila

jenkins test sanity alinux64 jdk21

tajila avatar Feb 20 '24 17:02 tajila