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

Potential cyclic dependencies between Gregorian and CalendarSystem

    XMLWordPrintable

Details

    • b17
    • generic
    • generic
    • Verified

    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

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: