[Mondrian] assumed memory leak causes oome in Mondrian 3.1.6

Plöger, Henning hploeger at zeb.de
Thu Apr 8 12:41:10 EDT 2010

Dear all,

Recently we reproducible got an OutOfMemoryException after executing many different queries one after another.
Looking at the heap dump taken on OOME or after a certain amount of queries showed a suspicious schema object referencing
multiple hundred megabytes growing on each query. The GC seems not to be able to remove these objects
although - I thought that - these objects are softly referenced in Mondrian's cache.

Further investigation showed that the whole object tree is hard referenced from a threadlocal variable. Since we
run Mondrian within an application server that  uses an thread pool there were many of these dangling threadlocals and
the GC was never able to clean the cache.

To further stress our hypothesis we removed the threadlocal after each request/query and run our test again. Now we
could clearly see that the GC freed the heap, the OOME disappeared and a heap dump showed no hard
referenced objects from Mondrian anymore.

The problematic threadlocal variable is mondrian.rolap.RolapStar.localAggregations. The AggregationKey object holds a
reference path to the RolapStar object which references the threadlocal. This reference chain prevents the GC from
removing the threadlocal (threadlocal referenced by threadlocal's value).

Is this threadlocal variable intended to be removed after each request?
Does removing the threadlocal variable after each request yield another behavior?
Are the query results guaranteed to be the same as before (our tests let us assume so)?

Kind regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20100408/d2f9cd88/attachment.html 

More information about the Mondrian mailing list