DO NOT REPLY [Bug 51150] Add DecimalFormatCache.clean() method to prevent memory leak with Tomcat

2011-05-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51150

--- Comment #1 from Unlogic unlo...@unlogic.se 2011-05-18 06:39:00 UTC ---
I checked out the code from the FOP 1.0 tag and looked at the
DecimalFormatCache.

From what I can see this type of caching using ThreadLocal will not work well
any environment where thread pools are used and where applications can be
deployed and undeployed in runtime such as J2EE web applications.

A workaround until a fix is out is to create a new thread for each PDF
generation and the let the thread from the thread pool call the join() method
on the new thread. This resolves the memory leak but on other hand makes the
cache essentially pointless.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 51150] Add DecimalFormatCache.clean() method to prevent memory leak with Tomcat

2011-05-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51150

Unlogic unlo...@unlogic.se changed:

   What|Removed |Added

 CC||unlo...@unlogic.se

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 51150] Add DecimalFormatCache.clean() method to prevent memory leak with Tomcat

2011-05-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51150

--- Comment #2 from Unlogic unlo...@unlogic.se 2011-05-18 12:12:27 UTC ---
I've done some more research and from what I can see DecimalFormatCache is the
only place in the FOP source where ThreadLocal is used. So there doesn't seem
to be any more memory leaks in the FOP code related to ThreadLocal.

Would a patch that which simply removes the DecimalFormatCache be accepted
until a better solution comes around?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.


DO NOT REPLY [Bug 51150] Add DecimalFormatCache.clean() method to prevent memory leak with Tomcat

2011-05-18 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51150

--- Comment #3 from Andreas L. Delmelle adelme...@apache.org 2011-05-18 
18:28:19 UTC ---
(In reply to comment #2)
 I've done some more research and from what I can see DecimalFormatCache is the
 only place in the FOP source where ThreadLocal is used. So there doesn't seem
 to be any more memory leaks in the FOP code related to ThreadLocal.
 
 Would a patch that which simply removes the DecimalFormatCache be accepted
 until a better solution comes around?

No, unless it also solves the issue that prompted the use of ThreadLocal to
begin with. The reason why this is so, is because DecimalFormat is not
thread-safe. This could potentially lead to weird behavior in case of multiple
concurrent runs in the same JVM.

As for an alternative solution that would make sense: do something similar to
what was done for color profiles, i.e. make sure all usage of DecimalFormat is
properly synchronized.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.