struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4536) potential memory leak with annotationActionValidatorManager
Date Mon, 17 Aug 2015 18:38:46 GMT

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

Lukasz Lenart commented on WW-4536:
-----------------------------------

{quote}
Is it necessary to keep track of entries for abstract classes?
{quote}

I assume you are asking about {{validatorFileCache}} - it contains all possible files with
validators' config to reduce I/O operations

{quote}
In terms of keeping track of what's assigned and not, I'll look, the majority that I see are
definitely empty.
{quote}

After deeper investigation it isn't a good idea, the key will be the same in both cases so
there be no reduction in memory consumption

{quote}
How would I override the buildValidatorKey?
{quote}

Implement your own version of {{ActionValidatorManager}} by sub-classing {{AnnotationActionValidatorManager}}
then define a bean and set your validation manager as a default one

{code:xml}
<bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="myValidator"
class="com.company.MyAnnotationActionValidatorManager" />

<constant name="struts.actionValidatorManager" value="myValidator"/>
{code}

{quote}
Is there any harm in allowing the {{validatorCache}} and {{validatorFileCache}} to be purgeable?
{quote}

Can be but it looks like a temporary solution for me.

> potential memory leak with annotationActionValidatorManager
> -----------------------------------------------------------
>
>                 Key: WW-4536
>                 URL: https://issues.apache.org/jira/browse/WW-4536
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.3.20
>            Reporter: adam brin
>             Fix For: 2.3.x
>
>         Attachments: Screen Shot 2015-08-16 at 1.48.30 PM.png, Screen Shot 2015-08-16
at 1.49.22 PM.png
>
>
> We've recently been having issues with our app crashing and trying to track down the
root causes.  One of the things we've seen is that over the course of 1 day, 50% of our memory
(almost 620 MB of 1.2 GB)  is allocated to "com.opensymphony.xwork.validator.AnnotationActionValidatorManager"
according to the heap dump. We also see millions of entries in two SynchronizedMap's:
> * validatorCache (1,635,019  entries)
> * validatorFileCache (87,321 entries)
> Looking through the entries in the validator cache, we se entries for every unique page
browsed within the app. Note: we're using staticParam mapping and NamedVariable PatternMatching
in action names e.g. {{"$\{id\}/$\{slug\}"}} so effectively every url is unique.
> Looking at the source code, should these maps perhaps be "WeakHashMaps" or WeakReferences
so that they're disposed of?
> (source code to the app is here: https://bitbucket.org/tdar/tdar.src/src )



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message