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

Potential off-heap memory leak, while FileChannel.map

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8u66
    • core-libs
    • x86
    • linux

      FULL PRODUCT VERSION :
      1.8.0_66 and early


      ADDITIONAL OS VERSION INFORMATION :
      3.13.0-62-generic #102~precise1-Ubuntu SMP Wed Aug 12 14:09:54 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      There is potential problem in map() method in implementation of sun.nio.ch.FileChannelImpl class.
      The problem is that the "new FileChannelImpl.Unmapper(...)" and later newMappedByteBuffer(...) invorkation will not wrapped in try-catch, but object creation MAY cause to throw OutOfMemoryError. If this happens, the previously mapped memory is not unmapped, and no way to release it.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      RandomAccessFile raf = new RandomAccessFile("/tmp/1.tmp", "rw");
      FileChannel fc = raf.getChannel();
      ...do fill heap...
      try{
      MappedByteBuffer buf = fc.map(FileChannel.MapMode.READ_WRITE, start, len);
      }catch(IOException ex){
      //MAY off-heap memory leak
      }



      REPRODUCIBILITY :
      This bug can be reproduced rarely.

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: