Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6989

Implement MMapDirectory unmapping for coming Java 9 changes

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.5.4, 6.0, 6.4
    • core/store

    Description

      Originally, the sun.misc.Cleaner interface was declared as "critical API" in JEP 260

      Unfortunately the decission was changed in favor of a oficially supported java.lang.ref.Cleaner API. A side effect of this change is to move all existing sun.misc.Cleaner APIs into a non-exported package. This causes our forceful unmapping to no longer work, because we can get the cleaner instance via reflection, but trying to invoke it will throw one of the new Jigsaw RuntimeException because it is completely inaccessible. This will make our forceful unmapping fail. There are also no changes in Garbage collector, the problem still exists.

      For more information see this mailing list thread.

      This commit will likely be done, making our unmapping efforts no longer working. Alan Bateman is aware of this issue and will open a new issue at OpenJDK to allow forceful unmapping without using the now private sun.misc.Cleaner. The idea is to let the internal class sun.misc.Cleaner implement the Runable interface, so we can simply cast to runable and call the run() method to unmap. The code would then work. This will lead to minor changes in our unmapper in MMapDirectory: An instanceof check and casting if possible.

      I opened this issue to keep track and implement the changes as soon as possible, so people will have working unmapping when java 9 comes out. Current Lucene versions will no longer work with Java 9.

      Attachments

        1. LUCENE-6989.patch
          11 kB
          Uwe Schindler
        2. LUCENE-6989.patch
          6 kB
          Uwe Schindler
        3. LUCENE-6989.patch
          6 kB
          Uwe Schindler
        4. LUCENE-6989.patch
          2 kB
          Uwe Schindler
        5. LUCENE-6989-disable5x.patch
          3 kB
          Uwe Schindler
        6. LUCENE-6989-disable5x.patch
          2 kB
          Uwe Schindler
        7. LUCENE-6989-fixbuild148.patch
          1 kB
          Uwe Schindler
        8. LUCENE-6989-v2.patch
          3 kB
          Uwe Schindler
        9. LUCENE-6989-v3-post-b148.patch
          10 kB
          Uwe Schindler
        10. LUCENE-6989-v3-post-b148.patch
          9 kB
          Uwe Schindler
        11. LUCENE-6989-v3-testFixes.patch
          9 kB
          Uwe Schindler

        Issue Links

          Activity

            People

              uschindler Uwe Schindler
              uschindler Uwe Schindler
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: