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

Rendezvous GC threads under STS for monitor deflation

    XMLWordPrintable

Details

    • b22
    • generic
    • generic

    Description

      Object monitors are deflated concurrently by the MonitorDeflationThread. It first unlinks monitors from objects (i.e. restore the original object header), then handshakes (with a no-op) all Java threads, and only then destroys the monitors. This way, Java threads can safely (and racily) access monitors before the handshake, because the monitors are guaranteed to still exist when a Java thread racily reads a mark-word that is being unlinked, and the monitor can safely be destroyed after the handshake, because all Java threads would then read the correct unlinked mark-word.

      However, GC threads are not rendezvous'ed like that, and can read potentially dead monitors. This is a problem for compact object headers (JDK-8294992) because GC threads need to be able to safely access the Klass* which would then be stored in the object header, and might be displaced into a monitor.

      In order to safely access monitors via object headers concurrently from GC threads, we need to rendezvous them after unlinking and before destroying the monitors, just like Java threads do, via handshake. This is important so that concurrent GCs (ZGC, Shenandoah, G1) can safely access object's Klass* (and thus object size, layout, etc) during concurrent GC phases.

      Attachments

        Issue Links

          Activity

            People

              rkennke Roman Kennke
              rkennke Roman Kennke
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: