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

(sc) SocketChannel gathering writing throws OOME when G1 enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6u10
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      1.6.14_b01

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      We are using java.nio for communication and have no caching of direct byte buffers. When testing build 1.6.0_14-ea-b01 with G1 we experienced very soon OutOfMemoryErrors:

      Switching off (or: not on) G1garbage collector fixes the problem.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      NIO communication with HeapByteBuffer's

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No OutOfMemoryError
      ACTUAL -
      java.lang.OutOfMemoryError: Direct buffer memory

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.OutOfMemoryError: Direct buffer memory
      at java.nio.Bits.reserveMemory(Bits.java:633)
      at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
      at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
      at sun.nio.ch.IOUtil.write(IOUtil.java:134)
      at sun.nio.ch.SocketChannelImpl.write0(SocketChannelImpl.java:365)
      at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:388)
      at de.espirit.firstspirit.server.io.GatheringWriteBuffer.write(GatheringWriteBuffer.java:34)
      ...

      java.lang.OutOfMemoryError: Direct buffer memory
      at java.nio.Bits.reserveMemory(Bits.java:633)
      at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
      at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
      at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:57)
      at sun.nio.ch.IOUtil.write(IOUtil.java:69)
      at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
      at de.espirit.firstspirit.server.io.DirectChannelIO.write(DirectChannelIO.java:31)
      ...

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Switch of (or: not on) G1 garbage collector

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: