You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Pablo Gra\\~na" <pa...@globant.com> on 2008/10/15 03:21:48 UTC

possible resource leak on war redeploy (tapestry 4.1)

Hi there. I think a found a resource leak in RegexpMatcher. It uses commons-pool 
to cache the compiled regexps, with an eviction thread. The problem is that 
nobody is calling close on the pool, so the eviction thread is always alive, 
making the class loader not collectable. Here are the retade code fragments:

     public RegexpMatcher()
     {
         _pool = new GenericKeyedObjectPool(_factory);

         _pool.setMinEvictableIdleTimeMillis(EVICT_IDLE_TIME);
         _pool.setTimeBetweenEvictionRunsMillis(SLEEP_TIME);
     }

(setMinEvictableIdleTimeMillis with a time different from -1 starts the eviction 
thread).

No call is ever made to _pool.close(), and _pool is private.

I don't know what is the correct solution for this. One thing I can think of is 
making _pool static, and expose a static close method on RegexpMatcher so that 
it can be called on context shut down (does tapestry have a hook called on 
context shut down?)

thanks a lot.

-- 
Pablo Gra\~na
Chief Architect
Globant
Arg Office: +54 (11) 4109 1743
UK  Office: +44 (20) 7043 8269 int 8043
US  Office: +1 (212) 400 7686 int 8043


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org