Uploaded image for project: 'Netty'
  1. Netty
  2. NETTY-424

java.lang.OutOfMemoryError: Direct buffer memory

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.2.Final
    • None
    • Bootstrap
    • None

    Description

      • Test:
        for (int i = 0; i < Integer.MAX_VALUE; i ++) {
            ChannelFactory channelFactory = new NioClientSocketChannelFactory(
                    Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
            Bootstrap bootstrap = new ClientBootstrap(channelFactory);
            bootstrap.setPipelineFactory(new ChannelPipelineFactory() { ... });
            ChannelFuture future = bootstrap.connect(serverAddress);
            future.await(); // or future.addListener(new ChannelFutureListener() { ... }); 
            Channel channel = future.getChannel();
            channel.close();
            // FIXME NioClientSocketChannelFactory direct buffer memory leak
            channelFactory.releaseExternalResources(); // or bootstrap.releaseExternalResources();
        }
        
      • Circumvent:
        static NioClientSocketChannelFactory
      • Exception:

        Caused by: 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 org.jboss.netty.channel.socket.nio.SocketSendBufferPool$Preallocation.<init>(SocketSendBufferPool.java:159)
        at org.jboss.netty.channel.socket.nio.SocketSendBufferPool.<init>(SocketSendBufferPool.java:46)
        at org.jboss.netty.channel.socket.nio.NioWorker.<init>(NioWorker.java:84)
        at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.<init>(NioClientSocketPipelineSink.java:74)
        at org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory.<init>(NioClientSocketChannelFactory.java:135)

      Attachments

        Activity

          People

            trustin_jira Trustin Lee (Inactive)
            liangfei0201 liangfei liang
            Archiver:
            ranumula@redhat.com Raju Anumula

            Dates

              Created:
              Updated:
              Archived:

              PagerDuty