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

Cleaner has reachabilityFence in wrong place

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 20
    • core-libs
    • None
    •  

       

      During the review of java.lang.ref.Cleaner it was recognized that reachabilityFence was needed to ensure the referent and the cleaner remained live beyond certain operations. A temporary workaround was put in place and later replaced with reachabilityFence once it became available (JDK-8145459). Unfortunately, I think that was done in the wrong place.

      The reachabilityFences are at the end of the PhantomCleanable constructor. However, this could permit the cleanup to be triggered before the later assignment of CleanerImpl.PhantomCleanableRef's action field. (This is the same kind of problem as discussed in JDK-8149610.) The fences need to follow that assignment, either at the end of PhantomCleanableRef's constructor or (probably better) at the end of Cleaner.register.

            bchristi Brent Christian
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: