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

Use asynchronous handshake to support shared arena close

    XMLWordPrintable

Details

    Description

      When a thread T closes a shared arena, the following operations are performed:

      1. check that the session is still alive
      2. put the session in the CLOSING state - from this point on, any subsequent attempt to access the segment will throw ISE (because MemorySession::checkValidState will fail - assuming they see the new value)
      3. start the thread-local handshake. Two outcomes are possible:
        a) If the handshake succeeds (no threads are found accessing the segments) the session moves to CLOSED;
        b) Otherwise, the session is put back into the ALIVE state (which means that subsequent accesses will succeed again!)

      This logic is problematic, as it is possible for accessing threads to observe IllegalStateException, and then to see that the scope of the accessed segment is still alive!

      Attachments

        Issue Links

          Activity

            People

              eosterlund Erik Ă–sterlund
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: