Why does NAME_TO_CONTEXT map in the heap keep growing on the engine that is executing cache queries?

Why does NAME_TO_CONTEXT map in the heap keep growing on the engine that is executing cache queries?

book

Article ID: KB0089325

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Resolution:
Abstract:
===========
Why does NAME_TO_CONTEXT map in the heap keep growing on the engine responsible for executing cache queries?
  
Description:
============
We have seen some scenarios when using the Query.Util.executeInDynamicQuerySession() call to execute queries where there was constant heap growth on the engine executing the queries. If you take a heap dump and observe the leak suspects and objects that are occupying most of the space you will see that there is a common suspect as follows:

The class "com.tibco.cep.query.functions.QueryFunctions", loaded by "sun.misc.Launcher$AppClassLoader @ 0x700c62a50", occupies 1,872,078,208 (96.87%) bytes. The memory is accumulated in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "&ltsystem class loader>".

Keywords
sun.misc.Launcher$AppClassLoader @ 0x700c62a50
java.util.concurrent.ConcurrentHashMap$Segment[]
com.tibco.cep.query.functions.QueryFunctions


Environment:
===========
ALL TIBCO BusinessEvents 5.1.x ENVIRONMENTS
  
Symptoms:
========
You will observe constant heap growth on the engine executing the cache queries.

Cause:
=====
If the cache query is constructed with filters being appended each time, the query at run-time will be different each time. Yet, if the 3rd parameter in the executeInDynamicQuerySession is true (which means query reuse = true) TIBCO BusinessEvents will cache the query in the NAME_TO_CONTEXT map for faster lookup. This results in each and every query being cached in NAME_TO_CONTEXT map resulting in heap growth.


Resolution:
==========
Setting the Reuse flag to TRUE makes sense for parameterized queries (queries using bind variables) or static queries. If you have dynamic queries which do not use bind variables then you should set the reuse=false. This will stop the NAME_TO_CONTEXT map from increasing.

Issue/Introduction

Why does NAME_TO_CONTEXT map in the heap keep growing on the engine that is executing cache queries?