You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2023/03/08 13:50:51 UTC

[Bug 66521] New: ThreadLocal memory leak in Tomcat

https://bz.apache.org/bugzilla/show_bug.cgi?id=66521

            Bug ID: 66521
           Summary: ThreadLocal memory leak in Tomcat
           Product: POI
           Version: 5.2.3-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: nicola.isotta@gmail.com
  Target Milestone: ---

Created attachment 38521
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38521&action=edit
tomcat reported memory leak

We are getting memory leaks in Tomcat, and they seem to be caused by
HSSFCellStyle
(https://github.com/apache/poi/blob/aa9069c7df4c57088e68d884045f4066fa9ae098/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java#L123-L125)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66521] ThreadLocal memory leak in Tomcat

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66521

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
Apache POI uses thread-locals to improve performance of some operations. 

These are not real memory-leaks, as only a fixed amount of memory is allocated
and used per thread.

However Tomcat seems to perform some check on threads that are "returned to the
pool" and thus warns about these ThreadLocals still holding onto some objects. 


We have now added a method
org.apache.poi.util.ThreadLocalUtil#clearAllThreadLocals() which you can call
to clear out all thread-locals in Apache POI before finishing work inside the
Tomcat web-application.

This will be included in the next release.

See r1908263 for the implementation.

FYI, there is a similar method in XMLBeans which you may also need to call if
you are using code from module poi-ooxml.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66521] ThreadLocal memory leak in Tomcat

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66521

--- Comment #3 from Nicola Isotta <ni...@gmail.com> ---
Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66521] ThreadLocal memory leak in Tomcat

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66521

--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
Also added a FAQ entry for this via r1908266 at
https://poi.apache.org/help/faq.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org