[8u] RFR: 8269851: OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers
Andrew Hughes
gnu.andrew at redhat.com
Fri Aug 27 15:36:17 UTC 2021
On 11:35 Thu 26 Aug , Severin Gehwolf wrote:
> 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
>
>
Thanks. This looks fine. Please flag for approval.
--
Andrew :)
Pronouns: he / him or they / them
Senior Free Java Software Engineer
OpenJDK Package Owner
Red Hat, Inc. (http://www.redhat.com)
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
More information about the jdk8u-dev
mailing list