RFR: 8264524: jdk/internal/platform/docker/TestDockerMemoryMetrics.java fails due to swapping not working [v2]

Severin Gehwolf sgehwolf at openjdk.java.net
Tue Apr 6 09:43:26 UTC 2021


On Fri, 2 Apr 2021 04:10:47 GMT, Jie Fu <jiefu at openjdk.org> wrote:

>> Hi @jerboaa ,
>> 
>> After more thinking, I think the reason why memory.failcnt is always 0 is that there is no swap space on the host machine.
>> So the testMemoryFailCount should be skipped in that case.
>> 
>> But is there any API which can be used to get the swap space size of the host machine?
>> 
>> Thanks.
>
>> Consider a broken implementation of `Metrics.systemMetrics().getMemoryFailCount()`. Wouldn't the test now (falsely) pass?
> 
> Hi @jerboaa ,
> 
> A pre-test run has been added to check whether swapping really works for testMemoryFailCount.
> Swapping should be OK for memory.failcnt testing otherwise it will fail due to OOM killed.
> 
> What do you think?
> Thanks.

@DamonFool Hmm, if swap not working is the issue the test shouldn't enter the branch which you say is failing. From `MetricsMemoryTester.java`:

    private static void testMemoryFailCount() {
        long memAndSwapLimit = Metrics.systemMetrics().getMemoryAndSwapLimit();
        long memLimit = Metrics.systemMetrics().getMemoryLimit();

        // We need swap to execute this test or will SEGV
        if (memAndSwapLimit <= memLimit) { // <=============== This is checking whether or not swap works
            System.out.println("No swap memory limits, test case skipped");
        } else {

It has been added with JDK-8250984. So now I'm even more confused what's going on here...

-------------

PR: https://git.openjdk.java.net/jdk/pull/3286


More information about the hotspot-runtime-dev mailing list