You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Simon Nash (JIRA)" <de...@tuscany.apache.org> on 2010/11/11 22:30:14 UTC

[jira] Resolved: (TUSCANY-3770) Tomcat 7 reports a memory leak when stopping a Tuscany webapp

     [ https://issues.apache.org/jira/browse/TUSCANY-3770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Nash resolved TUSCANY-3770.
---------------------------------

       Resolution: Fixed
    Fix Version/s: Java-SCA-1.6.1

Fixed under revision r1033012 in the 1.x trunk and revision r1033692 in the 1.6.1 branch.

> Tomcat 7 reports a memory leak when stopping a Tuscany webapp
> -------------------------------------------------------------
>
>                 Key: TUSCANY-3770
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3770
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Web App Integration
>    Affects Versions: Java-SCA-1.6
>            Reporter: Simon Nash
>            Assignee: Simon Nash
>             Fix For: Java-SCA-1.6.1
>
>
> On Tomcat 7, when a Tuscany webapp is stopped, the following message is displayed:
>   SEVERE: The web application [/sample-calculator-webapp] created a ThreadLocal with key of type [null] (value
>   [org.apache.tuscany.sca.core.invocation.ThreadMessageContext$1@1b071c0]) and a value of type
>   [org.apache.tuscany.sca.core.invocation.MessageImpl] (value [org.apache.tuscany.sca.core.invocation.MessageImpl@fbf51d])
>   but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
> This happens because Tuscany adds a thread-local ThreadMessageContext object to every invocation thread when starting a request invocation and doesn't remove this object when the request is complete.
> There is code in WebAppServletHost.destroy() that attempts to remove this context information when the webapp is stopped.  This usually doesn't succeed in removing the context information because the ThreadLocal.remove() method only removes context information from the current thread and not from other threads.  There's no Java API for removing this information from other threads.
> The only way to remove this information is to track the completion of each request invocation and remove the context information from the current thread when the request has been completed.  The context information will be recreated for the next request on the thread.  This is very easy to implement by adding a few lines of code to the ThreadMessageContext class.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.