JDK-8238961 : Assertion failure in new field layout code when ContendedPaddingWidth == 0.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-02-12
  • Updated: 2020-02-25
  • Resolved: 2020-02-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15
15 b11Fixed
Related Reports
Relates :  
Description
If ContendedPaddingWidth is zero, method fill_holes() triggers an assertion failure when trying to insert the padding blocks.

#
#  Internal Error ( /openjdk/nb/rs6000_64/nightly/jdk/src/hotspot/share/classfile/fieldLayoutBuilder.cpp:48), pid=16449912, tid=258
#  assert(size > 0) failed: Sanity check
#

from

if (super_klass->has_contended_annotations()) {
    LayoutRawBlock* p = new LayoutRawBlock(LayoutRawBlock::PADDING, ContendedPaddingWidth);

Method fill_holes() should not try to insert a padding block itself, but should call FieldLayoutBuilder::insert_contended_padding() which is designed to handle the case where ContendedPaddingWidth is zero.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/c27f595b4dd0 User: fparain Date: 2020-02-13 16:23:51 +0000
13-02-2020

I'm going to make the field layout code robust against ContendedPaddingWidth being zero. Adding a guard to prevent the option to be zero requires more investigations. At least one test set this option to zero (test/hotspot/jtreg/runtime/contended/Options.java), and the initial report of this issue was on a specific platform on which it might make sense to have this option set to zero (not enough details on this yet).
13-02-2020

Got this failure too. I agree that ContendedPaddingWidth=0 is nonsensical, and should be guarded with options range that excludes zero. Please change the synopsis to reflect that?
12-02-2020

Unfortunately FieldLayoutBuilder::insert_contended_padding() cannot be used in method fill_holes() because it requires an initialized layout to work, but fill_holes() operated on a layout not fully initialized yet. Switching back to simpler solution: adding a check against ContendedPaddingWidth being zero.
12-02-2020