RFR: 8205928 - [TESTBUG]: jdk/internal/platform/docker/TestDockerMemoryMetrics.java fails depending on kernel config
Bob Vandette
bob.vandette at oracle.com
Tue Jul 3 14:02:55 UTC 2018
Matthais, who reported the issue, confirmed that this patch solves the problem.
Thanks,
Bob.
> On Jul 3, 2018, at 9:38 AM, Thomas Stüfe <thomas.stuefe at gmail.com> wrote:
>
> Hi Bob,
>
> It does look fine from the outside. I did not test it though, since I
> have no suitable kernel.
>
> Best Regards, Thomas
>
> On Tue, Jul 3, 2018 at 3:13 PM, Bob Vandette <bob.vandette at oracle.com> wrote:
>> Please review this small fix to correct a test failure when the Linux system kernel is
>> not configured with the CONFIG_MEMCG_KMEM option.
>>
>> The Container Metric tests are dependent on docker which allow us to assume a certain minimum
>> Linux kernel configuration level. However, the kernel memory resource limiting feature is not a hard
>> requirement for docker. This test will need to be updated to allow for running on kernels without this
>> option. A 0 return from the getKernelMemoryLimit is defined to indicate that this API is not available.
>>
>> BUG: https://bugs.openjdk.java.net/browse/JDK-8205928
>>
>> PROPOSED FIX:
>>
>> diff --git a/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java b/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java
>> --- a/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java
>> +++ b/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java
>> @@ -95,10 +95,11 @@
>>
>> private static void testKernelMemoryLimit(String value) {
>> long limit = getMemoryValue(value);
>> - if (limit != Metrics.systemMetrics().getKernelMemoryLimit()) {
>> + long kmemlimit = Metrics.systemMetrics().getKernelMemoryLimit();
>> + if (kmemlimit != 0 && limit != kmemlimit) {
>> throw new RuntimeException("Kernel Memory limit not equal, expected : ["
>> + limit + "]" + ", got : ["
>> - + Metrics.systemMetrics().getKernelMemoryLimit() + "]");
>> + + kmemlimit + "]");
>> }
>> System.out.println("TEST PASSED!!!");
>> }
More information about the serviceability-dev
mailing list