JDK-8261907 : runtime\Metaspace\MaxMetaspaceSizeEnvVarTest.java fails on 11u
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2021-02-17
  • Updated: 2021-02-22
  • Resolved: 2021-02-22
Related Reports
Duplicate :  
Relates :  
Description
We see this in 11u after JDK-8260349 had been downported:

At least on Windows, we see this error intermittently (? unclear):
```
"MetaspaceSize (12582912) must be less than or equal to MaxMetaspaceSize (9437184)
MaxMetaspaceSize (9437184) must be greater than or equal to MetaspaceSize (9437184)"
```

The reason for this seems obvious at first; MetaspaceSize is by default 12..16M (depends on platform) and the constraint complains.

But the constraint checker runs after the argument ergo phase, during which MetaspaceSize is adjusted to fit into MaxMetaspaceSize (see Metaspace::ergo_initialize). So, this should not happen at all.

Even more confusing is why this only happens in 11 (depite JEP387 MetaspaceSize has the same default size) and why only on one platform so far, and why intermittent. The intermittent part is unconfirmed though.

I tried to manually reproduce this on various platforms without luck.

Comments
Yes, the backport is being tested now
22-02-2021

I created JDK-8262113 for a backport of JDK-8217848 to 11u. Closing this one as duplicate.
22-02-2021

[~alexsch], could you please do the 11u backport this week to make sure it reaches 11.0.11 (since the regression was introduced in that version)?
22-02-2021

Thanks a lot for tracking that down, Alexandr. I was not aware that metaspace settings can change after ergo_initialize.
20-02-2021

When MaxMetaspaceSize is set from the command line or env var, MetaspaceSize is adjusted in Metaspace::ergo_initialize(). Later on, during CompilerConfig::ergo_initialize(), on platforms which have NeverActAsServerClassMachine flag set, VM is limited to client compiler operation mode in set_client_compilation_mode() and MetaspaceSize changed to 12M without taking into account the value of MaxMetaspaceSize. The problem is already fixed in the mainline, see https://bugs.openjdk.java.net/browse/JDK-8217848 We are going to backport JDK-8217848 which applies cleanly to 11u.
19-02-2021

We have finally found a configuration where we were able to reproduce the problem. Investigating the root cause.
19-02-2021

Is it possible that tests are being run with one of the JVM env vars set which was previously not processed for MaxMetaspaceSize?
18-02-2021

We see this issue on ntintel platform (32bit Windows) in 11u. It doesn't happen on other scenarios. However, the test doesn't run in OpenJDK head for this platform at SAP - it's possible that it would show up there, too.
17-02-2021