Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-44147

Lessons - memory leaks in SimplePageBean

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Awaiting Information
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Lessons
    • Labels:
      None
    • Test Plan:
      Hide

      If there's a better approach, feel free to edit; this is what I would do:

      1. Enable JMX and hook up a memory profiling tool
        1. The Admin Workspace -> Memory tool might do just as well?
      2. Get a benchmark on memory consumption
      3. Create large content in lessons, including embedding content like images
      4. Check memory consumption
      5. Wait until the cache eviction threshold has elapsed, and GC completes
      6. Ensure there is a significant drop in memory consumption
      Show
      If there's a better approach, feel free to edit; this is what I would do: Enable JMX and hook up a memory profiling tool The Admin Workspace -> Memory tool might do just as well? Get a benchmark on memory consumption Create large content in lessons, including embedding content like images Check memory consumption Wait until the cache eviction threshold has elapsed, and GC completes Ensure there is a significant drop in memory consumption

      Description

      We're using Sakai 11.3, and we encounter OutOfMemoryErrors, and thread starvation in production. I've inspected a heap dump in VisualVM, and here are some of my findings:

      1. The largest allocators of memory are HashMaps (unsurprisingly); but HashMap$Node consumed 18GB of the Heap
      2. The largest two instances of HashMap map were a Hibernate wrapper of Long to SimplePageItemImpl (discovered via VisualVM's 'instances' tab, and sorting by 'retained').
        1. There are only two HashMap<Long, SimplePageItem> instances in Sakai: cacheItem, and cacheItems in SimplePageBean. These aren't actually caches, just plain HashMaps with no eviction strategy, and it would seem that they're not getting GC'd.
        2. I wish I had numbers to indicate how much memory these HashMaps consumed in the heap dump, but VisualVM didn't display the retained size. Still, these two HashMaps had 524,288 items = 4 MB worth of HashMap$Node objects alone.
        3. If I'm not mistaken, SimplePageItems can contain html, including massive embedded content

      A glance in master, and this still appears to be the case (relevant code is identical).

      Use a standard caching strategy so that these potentially large members can be evicted.

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                Assignee:
                Unassigned Unassigned
                Reporter:
                bbailla2 Brian Baillargeon
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:

                    Git Integration