Jump to content
  • Another ThreadLocal leak


    sergio.rolanski
    CategoryBug report
    PriorityNormal
    ReproducibilityAlways
    ResolutionOpen
    SeverityMajor
    StatusNew
    Versionv6.0.3

    More threadlocal leaks, an API to shutdown these needs to be implemented.

    I can't shutdown

     

    GRAVE: The web application [/] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@604c492e]) and a value of type [java.lang.Class] (value [class Conta_FatAgrDataSet_1428677141286_420825]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Abr 10, 2015 12:38:43 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

    GRAVE: The web application [/] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@604c492e]) and a value of type [java.lang.Class] (value [class Conta_FatAgrDataSet_1428680257414_334538]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Abr 10, 2015 12:38:43 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

    GRAVE: The web application [/] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@604c492e]) and a value of type [java.lang.Class] (value [class SubRelHistoricoConsumo_1428680256726_123478]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Abr 10, 2015 12:38:43 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

    GRAVE: The web application [/] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@604c492e]) and a value of type [java.lang.Class] (value [class Conta_FatAgrDataSet_1428679366318_644315]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Abr 10, 2015 12:38:43 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

    GRAVE: The web application [/] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@604c492e]) and a value of type [java.lang.Class] (value [class SubRelHistoricoConsumo_1428679434364_224304]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak



    User Feedback

    Recommended Comments

    Changed Assigned User from - to @User_306070


    Seems classFromBytesRef was created to fix a crash in JVM, has been around since version 2.0 according to grepcode.It might not be needed anymore.Add this workaround in the destroy() of a ServletContextListener implementation:private void fixJasperLocalThread() { fixJasperLocalThread(FontUtil.class, "threadMissingFontsCache"); fixJasperLocalThread(JRAbstractJavaCompiler.class, "classFromBytesRef");}private void fixJasperLocalThread(Class<?> clazz, String fieldName) { try { Field field = clazz.getDeclaredField(fieldName); if (field != null) { field.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); field.set(null, null); } } catch (IllegalAccessException | NoSuchFieldException | SecurityException ex) { // ignorado }}
    Link to comment
    Share on other sites

    Changed Assigned User from @User_306070 to -


    Just downloaded 6.2 of Jaspersoft server.Still see: Threads are going to be renewed over time to try and avoid a probable memory leak.in the apache-tomcat\logs\jasperreportstomcat-stderr.2015-12-10.logIs this something to be concerned about.If so what is the fix, please be succinct and correct.
    Link to comment
    Share on other sites

    Add the following line to WEB-INF/classes/jasperreports.properties to avoid this particular ThreadLocal problem:

     

    net.sf.jasperreports.evaluator.class.reference.fix.enabled=false

     

    Regards,

    Lucian

    Link to comment
    Share on other sites

    I did that and I still get memory leaks.

    If you look at my first post you will see it does assign null to the static attribute in class FontUtil.

    This seems to fix half of the problem.

     

    Dez 11, 2015 10:31:40 org.apache.catalina.loader.WebappClassLoader

    ERROR: The web application [/] created a ThreadLocal with key of type [net.sf.jasperreports.engine.fonts.FontUtil$1] (value [net.sf.jasperreports.engine.fonts.FontUtil$1@3a5aa11a]) and a value of type [java.util.HashSet] (value [[]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Dez 11, 2015 10:31:40 org.apache.catalina.loader.WebappClassLoader

    ERROR: The web application [/] created a ThreadLocal with key of type [net.sf.jasperreports.engine.fonts.FontUtil$1] (value [net.sf.jasperreports.engine.fonts.FontUtil$1@3a5aa11a]) and a value of type [java.util.HashSet] (value [[]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Dez 11, 2015 10:31:40 org.apache.catalina.loader.WebappClassLoader

    ERROR: The web application [/] created a ThreadLocal with key of type [net.sf.jasperreports.engine.fonts.FontUtil$1] (value [net.sf.jasperreports.engine.fonts.FontUtil$1@3a5aa11a]) and a value of type [java.util.HashSet] (value [[]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Dez 11, 2015 10:31:40 org.apache.catalina.loader.WebappClassLoader

    ERROR: The web application [/] created a ThreadLocal with key of type [net.sf.jasperreports.engine.fonts.FontUtil$1] (value [net.sf.jasperreports.engine.fonts.FontUtil$1@3a5aa11a]) and a value of type [java.util.HashSet] (value [[]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Dez 11, 2015 10:31:40 org.apache.catalina.loader.WebappClassLoader

    ERROR: The web application [/] created a ThreadLocal with key of type [net.sf.jasperreports.engine.fonts.FontUtil$1] (value [net.sf.jasperreports.engine.fonts.FontUtil$1@3a5aa11a]) and a value of type [java.util.HashSet] (value [[]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Dez 11, 2015 10:31:40 org.apache.catalina.loader.WebappClassLoader

    ERROR: The web application [/] created a ThreadLocal with key of type [net.sf.jasperreports.engine.fonts.FontUtil$1] (value [net.sf.jasperreports.engine.fonts.FontUtil$1@3a5aa11a]) and a value of type [java.util.HashSet] (value [[]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

    Dez 11, 2015 10:31:41 org.apache.catalina.startup.HostConfig

    INFO: Undeploying context [/]

     

    Link to comment
    Share on other sites

    Right, net.sf.jasperreports.evaluator.class.reference.fix.enabled only addresses the specific problem that the original bug description and comment #1 talk about.

     

    There are other similar problems (more ThreadLocals) for which I don't think that we have a solution at the moment. We'll have to go into the code and see if we can dispense of each ThreadLocal.

    Link to comment
    Share on other sites

    We are also facing memory leaks due to net.sf.jasperreports.engine.fill.JRVirtualizationContext.contexts storing huge object reference in tomcat threadlocal. Please let me know what we can do. Our application is a web application.
    Link to comment
    Share on other sites


×
×
  • Create New...