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

Topic memory leak on message eviction using UniquePropertyMessageEvictionStrategy

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.16.0
    • Fix Version/s: 5.17.0, 5.16.1, 5.15.14
    • Component/s: Broker
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Flags:
      Patch

      Description

      The current implementation of UniquePropertyMessageEvictionStrategy does not conform to the expected behaviour of a MessageEvictionStrategySupport implementation resulting in a memory leak.

      All MessageEvictionStrategySupport implementations remove from the passed list of MessageReference objects the messages that should be evicted and then returns those items in an array. The calling code expects this to be the case and decrements message reference counters accordingly.

      The current implementation of UniquePropertyMessageEvictionStrategy does one of two things depending on the state of the buffered messages:

      1. If the buffer already contains a single message per unique property then the oldest message is returned in the array for message removal but is not removed from the passed message list. This leaves a reference to the message intended for removal in the passed message reference list - not intended behaviour. (i.e. intended behaviour is identical to OldestMessageEvictionStrategy)
      2. If the buffer contains more than one instance of a message with the same unique property then only the latest messages (largest timestamp) for each of those sets are removed from the passed list of message references. At this point, the passed list of message references contains all the messages we expect to be removed so it is converted to an array and returned. But this list should contain all those messages that should be retained - not intended behaviour.

      The patch contains the necessary changes to UniquePropertyMessageEvictionStrategy to prevent this memory leak and an assertion added to the UniquePropertyMessageEvictionStrategyTest.testEviction to demonstrate the memory is correctly freed after applying the fix.

        Attachments

          Activity

            People

            • Assignee:
              jbonofre Jean-Baptiste Onofré
              Reporter:
              fcrossman Fraser Crossman

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m

                  Issue deployment