You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "John Wagenleitner (JIRA)" <ji...@apache.org> on 2016/01/21 23:17:39 UTC

[jira] [Comment Edited] (GROOVY-4177) Groovy categories cause tomcat memory leak and prevent tomcat shutting down

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

John Wagenleitner edited comment on GROOVY-4177 at 1/21/16 10:17 PM:
---------------------------------------------------------------------

Based on the [code in GroovyCategorySupport.java|https://github.com/apache/groovy/blob/425362539843a686b9ab2a0c199d1c2b0a184331/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java] at the time this JIRA was created it looks like the problem was that the ThreadLocal was never cleaned up.  Since that time [code has been added to call {{ThreadLocal.remove()}}|https://github.com/apache/groovy/blob/7cb20675e1f166fed1dc87bafc8203f91e7b5627/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java#L88] in [commit 7cb20675e|https://github.com/apache/groovy/commit/7cb20675e1f166fed1dc87bafc8203f91e7b5627] as a fix for GROOVY-4130.


was (Author: jwagenleitner):
Based on the [code in GroovyCategorySupport.java|https://github.com/apache/groovy/blob/425362539843a686b9ab2a0c199d1c2b0a184331/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java] at the time this JIRA was created it looks like the problem was that the ThreadLocal was never cleaned up.  Since [Code has added to call {{ThreadLocal.remove()}}|https://github.com/apache/groovy/blob/7cb20675e1f166fed1dc87bafc8203f91e7b5627/src/main/org/codehaus/groovy/runtime/GroovyCategorySupport.java#L88] in [commit 7cb20675e|https://github.com/apache/groovy/commit/7cb20675e1f166fed1dc87bafc8203f91e7b5627] as a fix for GROOVY-4130.

> Groovy categories cause tomcat memory leak and prevent tomcat shutting down
> ---------------------------------------------------------------------------
>
>                 Key: GROOVY-4177
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4177
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 1.7.2
>            Reporter: Graeme Rocher
>            Assignee: John Wagenleitner
>            Priority: Critical
>             Fix For: 1.8.0
>
>
> Any Groovy application (including Grails apps) that deploy to Tomcat 6.0.26 and above has this issue because basically Tomcat clears thread locals not manually shutdown by the application to prevent memory leaks.
> This can lead to problems starting and stopping Groovy based application with errors like the following occuring:
> {code}
>     [java] Exception in thread "Thread-3" java.lang.NullPointerException
>      [java] 	at org.codehaus.groovy.runtime.GroovyCategorySupport.hasCategoryInCurrentThread(GroovyCategorySupport.java:216)
>      [java] 	at groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:1128)
>      [java] 	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904)
>      [java] 	at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:915)
>      [java] 	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>      [java] 	at groovy.lang.Closure.call(Closure.java:276)
>      [java] 	at groovy.lang.Closure.call(Closure.java:271)
>      [java] 	at groovy.lang.Closure.run(Closure.java:354)
> {code}
> Groovy needs to include the ability to manually shutdown the any categories that exist in any threads and also re-instate the categories if they are nulled (like what happens with Tomcat)



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