Skip to content

Application with Sentry logger fails to remove ThreadLocal when app is stopped on Tomcat #420

@wojciechmusial

Description

@wojciechmusial

I'm using Tomcat 8 and lastest version of Sentry SDK:

<dependency>
      <groupId>io.sentry</groupId>
      <artifactId>sentry-log4j2</artifactId>
      <version>1.1.0</version>
</dependency>

I configured my logging in files:

log4j2.properties

appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

appender.sentry.type=Sentry
appender.sentry.name=Sentry

rootLogger.level=WARN
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.sentry.ref=Sentry
rootLogger.appenderRef.sentry.level=WARN

sentry.properties

dsn=<my_sentry_dsn>
async.gracefulshutdown=false

I assumed that using async.gracefulshutdown=false will kill all running threads properly, so that my application is not exposed to any memory leak problems. When I redeploy my application Tomcat is reporting that ThreadLocal connected to Sentry failed to be removed:

19-Jun-2017 22:06:57.423 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [io.sentry.context.ThreadLocalContextManager$1] (value [io.sentry.context.ThreadLocalContextManager$1@5d7c6e1d]) and a value of type [io.sentry.context.Context] (value [io.sentry.context.Context@40c92b58]) 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.

Is there something that could be done in reference to above issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions