java.lang.OutOfMemoryError Reported by the GlassFish Message Queue Broker Caused by DirectByteBuffer Allocations

(Doc ID 1319317.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle GlassFish Server - Version 2.1 and later
Information in this document applies to any platform.
***Checked for relevance on 17-Jun-2013***

Symptoms

When running GlassFish Message Queue on a 32-bit JVM with a large Java heap and with a "shared" thread pool management configuration for the Message Queue (MQ) broker, an "OutOfMemoryError" could occur. An error message similar to this can be seen in the MQ broker's  log file:

[07/Apr/2011:18:58:52 MEST] ERROR Received Out Of Memory Error [[B0013]: Running low on memory while writing a message to a client, the current message may be lost]:
java.lang.OutOfMemoryError
at sun.misc.Unsafe.allocateMemory(Native Method)
at java.nio.DirectByteBuffer.(DirectByteBuffer.java:99)
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 com.sun.messaging.jmq.io.Packet.myChannelWrite(Packet.java:2022)
at com.sun.messaging.jmq.io.Packet.writePacket(Packet.java:1514)
at com.sun.messaging.jmq.jmsserver.service.imq.IMQIPConnection.writeOutPacket(IMQIPConnection.java:1411)
at com.sun.messaging.jmq.jmsserver.service.imq.IMQIPConnection.writeData(IMQIPConnection.java:1605)
at com.sun.messaging.jmq.jmsserver.service.imq.group.WriteThread.process(WriteThread.java:121)
at com.sun.messaging.jmq.jmsserver.service.imq.group.SelectThread.processThread(SelectThread.java:427)
at com.sun.messaging.jmq.jmsserver.service.imq.group.GroupRunnable.process(GroupRunnable.java:144)
at com.sun.messaging.jmq.jmsserver.util.pool.BasicRunnable.run(BasicRunnable.java:493)
at java.lang.Thread.run(Thread.java:619)
[07/Apr/2011:18:58:53 MEST] [B1047]: Shutting down broker...

Changes

Changing the thread pool management configuration mode from "dedicated", which is the default, to "shared", as described in the MQ Administration Guide, can trigger this issue.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms