Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8253136

JMM_VERSION should remain at 0x20020000 (JDK 10) in JDK 11

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 11.0.9
    • Component/s: core-svc
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      The current behavior is a bug and is fixed by this CSR.
    • Interface Kind:
      Java API
    • Scope:
      JDK

      Description

      Summary

      Change JMM_VERSION to 0x2002000 (JDK 10) in 11.0.9, and the @since javadoc tag for com.sun.managment.ThreadMXBean.getCurrentThreadAllocatedBytes to 11.0.9.

      Problem

      JDK-8231209, which was originally pushed to JDK 14, has been backported to 11.0.9 and 11,0.10-oracle. Those backports changed JMM_VERSION from 0x20020000 (JDK 10) to 0x20030000 (JDK 14), which introduced an incompatibility that was overlooked in the backport CSRs JDK-8247807 (11.0.9) and JDK-8248871 (11.0.10-oracle). JDK 11 users checking for JMM_VERSION == 0x20020000 will find 0x2003000 instead and possibly abort. The issue was first noticed as part of reviewing a backport of JDK-8185003 to JDK 8: see the Description in the corresponding CSR JDK-8251498.

      Solution

      JMM_VERSION in JDK 11 should be changed to 0x20020000 (JDK 10), and the @since javadoc tag for com.sun.management.ThreadMXBean.getCurrentThreadAllocatedBytes should be changed from 14 to 11.0.9.

      Specification

      Proposed patch:

      --- old/src/hotspot/share/include/jmm.h 2020-09-14 14:12:47.000000000 -0700
      +++ new/src/hotspot/share/include/jmm.h 2020-09-14 14:12:45.000000000 -0700
      @@ -51,8 +51,7 @@
         JMM_VERSION_1_2_1 = 0x20010201, // JDK 7 GA
         JMM_VERSION_1_2_2 = 0x20010202,
         JMM_VERSION_2   = 0x20020000, // JDK 10
      -  JMM_VERSION_3   = 0x20030000, // JDK 14
      -  JMM_VERSION     = JMM_VERSION_3
      +  JMM_VERSION     = JMM_VERSION_2
       };
      
       typedef struct {
      --- old/src/jdk.management/share/classes/com/sun/management/ThreadMXBean.java   2020-09-14 14:12:53.000000000 -0700
      +++ new/src/jdk.management/share/classes/com/sun/management/ThreadMXBean.java   2020-09-14 14:12:52.000000000 -0700
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -135,7 +135,7 @@
            * @see #isThreadAllocatedMemoryEnabled
            * @see #setThreadAllocatedMemoryEnabled
            *
      -     * @since 14
      +     * @since 11.0.9
            */
           public default long getCurrentThreadAllocatedBytes() {
               return getThreadAllocatedBytes(Thread.currentThread().getId());

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              phh Paul Hohensee
              Reporter:
              phh Paul Hohensee
              Reviewed By:
              Volker Simonis
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: