Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-2103

Memory leak when marshaling ActiveMQTextMessage to persistent store

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.0.0
    • 5.4.2
    • Broker
    • None
    • ActiveMQ


      When an org.apache.activemq.command.ActiveMQTextMessage is marshaled into the persistence store some portion of the messages are stored in memory (i.e. pending cursor/consumer dispatch queue). The messages stored in memory have the potential to cause the broker to run out of memory because org.apache.activemq.command.ActiveMQTextMessage objects can store the data twice, once in the 'text' field and once in the 'content' field. Normally this isn't a problem since the 'content' field is cleared when the message is being used in a client application (i.e. by calling getText() clears content). The problem occurs when a consumer is slow and a large number of messages are sitting around on the broker in pending/dispatch memory space. The message is marshaled for the store and then persisted to disk and copied to pending memory when space is available.

      This bug affects any ActiveMQ*Message object that does not clear its temporary data (i.e. 'text' field) once it has been marshaled. When a message is marshaled we should null the derived objects memory space once the data has been written to the parent object's 'content' field.


        1. Duplicate Message Data (Internal Marshalling).png
          77 kB
          Trevor Pounds
        2. jhat_ActiveMQTextMessage_0xe837a478.htm
          4 kB
          Trevor Pounds
        3. jhat_ByteSequence_0xe837a5c0.htm
          1 kB
          Trevor Pounds
        4. jhat_ByteSequence_data_0xe837adb0.htm
          6 kB
          Trevor Pounds
        5. AMQ-2103.diff
          0.5 kB
          Trevor Pounds
        6. heap_100_1MB_messages.png
          93 kB
          Trevor Pounds

        Issue Links


          This comment will be Viewable by All Users Viewable by All Users


            gtully Gary Tully
            tpounds Trevor Pounds
            0 Vote for this issue
            0 Start watching this issue




                Issue deployment