Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-352

Possible memory leak regarding parser jjtree nodes in JEXL 3.2

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.2
    • 3.2.1
    • None
      • JEXL 3.2
      • Java 11
      • Jetty 9.4.41.v20210516

       

    Description

      Our application encountered a memory leak issue after upgrading from JEXL 3.1 to 3.2.

      It seems that every call to JexlEngine createExpression now adds new entries to engine.parser.jjtree.nodes. In our case we suddenly had millions of nodes in this list.

      This sample seems to reproduce the issue

      JexlEngine jexlEngine = new JexlBuilder().create();
      String testExpression = "dummy";
      
      jexlEngine.createExpression(testExpression); // jexlEngine.parser.jjtree.nodes.size() == 1
      jexlEngine.createExpression(testExpression); // jexlEngine.parser.jjtree.nodes.size() == 2
      

      We currently don't cache the returned expression and JexlEngine is configured with defaults as shown in the sample.

      Note that calling jexlEngine.clearCache() does not free the nodes.

      Attached screenshot for the hprof of our application with ~ 1.7 million nodes in jjtree.

       

      Attachments

        1. jexl-engine-hprof.png
          213 kB
          Øyvind Horneland

        Activity

          People

            henrib Henri Biestro
            oyvind.horneland Øyvind Horneland
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: