You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (Jira)" <ji...@apache.org> on 2021/06/17 09:47:00 UTC

[jira] [Comment Edited] (JEXL-352) Possible memory leak regarding parser jjtree nodes in JEXL 3.2

    [ https://issues.apache.org/jira/browse/JEXL-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17364778#comment-17364778 ] 

Henri Biestro edited comment on JEXL-352 at 6/17/21, 9:46 AM:
--------------------------------------------------------------

Good catch, thank you.

jjTreeParserState.java:
  /* Call this to reinitialize the node stack.  It is called
     automatically by the parser's ReInit() method. */
  public void reset() {...}

It appears ReInit() no longer call this method.


was (Author: henrib):
Good catch, thank you.


> Possible memory leak regarding parser jjtree nodes in JEXL 3.2
> --------------------------------------------------------------
>
>                 Key: JEXL-352
>                 URL: https://issues.apache.org/jira/browse/JEXL-352
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: * JEXL 3.2
>  * Java 11
>  * Jetty 9.4.41.v20210516
>  
>            Reporter: Øyvind Horneland
>            Assignee: Henri Biestro
>            Priority: Major
>             Fix For: 3.2.1
>
>         Attachments: jexl-engine-hprof.png
>
>
> 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
> {code:java}
> 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
> {code}
> 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.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)