[8u] RFR: 8269851: OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers
Severin Gehwolf
sgehwolf at redhat.com
Thu Aug 26 09:35:30 UTC 2021
On Tue, 2021-08-24 at 05:08 +0100, Andrew Hughes wrote:
> On 19:31 Mon 23 Aug , Severin Gehwolf wrote:
> > Hi,
> >
> > Please review this OpenJDK 8u backport of 8269851 which fixes an issue
> > of process CPU load calculation of the OS MXBean when run with CPU
> > limits in a container. Please see the bug how this manifests. The
> > OpenJDK 11u patch doesn't apply cleanly since getProcessCpu0() isn't in
> > 8u (introduced with JDK-8022323; non-public) and some context
> > differences.
> >
> > Part of this backport moves previously native getProcessCpuLoad() ->
> > getProcessCpuLoad0() and makes it private. Otherwise the patch is the
> > same as the JDK 11u variant.
> >
> > Bug: https://bugs.openjdk.java.net/browse/JDK-8269851
> > webrev: https://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8269851/jdk8/01/webrev/
> >
> > Testing: Builds on AIX, Solaris, Linux, Windows, Mac. Manual tests on
> > Linux x86_64 using the reproducer.
> >
> > Thoughts?
> >
> > Thanks,
> > Severin
> >
>
> I think we should bring in JDK-8022323 first. 8226575 already brought
> in a lot of the renamings on the UNIX side only, and it seems we'll be
> continually cherry-picking parts of 8022323 if changes are needed to
> the remaining functions. As it stands, the native functions are a bit
> of a mess of public and private functions, and at a mismatch with the
> Windows side.
>
> Plus, the fact that the bug description - "[JavaSecurityScanner]
> review package com.sun.management.* Native methods should be private"
> - suggests these changes were made due to some security scan makes me
> think this is a good thing to backport in its own right.
>
> I'll post the backport in its own thread. The Windows side was
> completely clean, and the changes on the UNIX side were only needed
> due to skipping the changes already made by 8226575.
>
> With that in, this change should be pretty close to the 11u one.
Alright, rebased version:
https://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8269851/jdk8/02/webrev/
The only conflict now is in the import statements.
Thoughts?
Thanks,
Severin
More information about the jdk8u-dev
mailing list