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

Potential cyclic dependencies between Gregorian and CalendarSystem

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b17
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        We find cyclic dependencies between Gregorian and CalendarSystem classes in our test environment when using JDK11 AOT(It also affects JDK tip).

        The class hierarchies are as follows(w/ some simplifications):

        ```
        class GregorianCalendar {
        static Gregorian base = CalendarSystem.getGregorianCalendar();
        }

        class Gregorian extends BaseCalendar { }
        class BaseCalendar extends AbstractCalendar {}
        class AbstractCalendar extends CalendarSystem {}

        public class CalendarSystem {
        Gregorian GREGORIAN_INSTANCE = new Gregorian();
        }
        ```

        We create two new threads to link GregorianCalendar and AbstractCalendar, respectively.

        T1: new GregorianCalendar()
        GregorianCalendar -> Gregorian -> BaseCalendar -> AbstractCalendar -> CalendarSystem

        T2: Unsafe.ensureInitialized(AbstractCalendar.class)
        AbstractCalendar -> CalendarSystem -> Gregorian

        What would next happen, is that application hanging due to deadlock between inGregorian and AbstractCalendar.

          Attachments

          1. aothang.txt
            83 kB
            Yi Yang
          2. aothang2.txt
            39 kB
            Yi Yang

            Issue Links

              Activity

                People

                Assignee:
                jpai Jaikiran Pai
                Reporter:
                yyang Yi Yang
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: