We're updating the issue view to help you get more done. 

Stripes fails to remove values from a ThreadLocal variable in StripesFilter, Tomcat says

Description

When undeploying a web-app which is using the Stripes Framework, Tomcat complains about a ThreadLocal variable not being clean, which would cause a memory leak. The exact error message is:

The web application [] created a ThreadLocal with key of type [null] (value [net.sourceforge.stripes.controller.StripesFilter$1@68de59f0]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

And in fact, it does create a memory leak, since reloading the webapp few times brings an OutOfMemoryError to the log.

I had a look at StripesFilter source code, and I coded a quick patch to fix this. It is working now, no memory leak. I could send you the patch file if you want to, but I just had to add one line to StripesFilter.java

Here it is:

— src/net/sourceforge/stripes/controller/StripesFilter.java (revision: 1343)
+++ src/net/sourceforge/stripes/controller/StripesFilter.java (working copy)
@@ -257,6 +257,7 @@

// Once the request is processed, take the Configuration back out of thread local
StripesFilter.configurationStash.remove();
+ StripesFilter.initialInvocation.remove();
}

Environment

Tested on Debian+Tomcat6, FreeBSD+Tomcat6, Mac+Tomcat6

Status

Assignee

BenB

Reporter

Roger de la Fuente

Labels

None

Tester

None

Components

Fix versions

Affects versions

Release 1.5.4
Release 1.5.2
Release 1.5.3
Release 1.5
Release 1.5.1

Priority

Minor