Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3772

Struts 2, Thread Locals reported by Tomcat after web application is stopped

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.1.8.1, 2.2.3.1, 2.3.1.2
    • 2.3.3
    • Dispatch Filter, Other
    • Windows 7, Struts 2.1.8.1/2.2.3.1/2.2.1.3, Spring 3.0.1

    Description

      When stopping or undeploying my struts 2 web app in Tomcat (7.0.23) I get several severe warnings from tomcat:

      SEVERE: The web application [/myapp] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1376afa]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@15075f9]) 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.

      I've hunted all over the web and found this error repeated in several places, but I haven't yet found a solution. I then found some posts that lead me to believe this was a problem in the xwork libs but that it had been resolved in the latest version:

      http://jira.opensymphony.com/browse/XW-560

      I also found a reference suggesting this could be a problem with using the deprecated FilterDispatcher rather than a StrutsPrepareAndExecuteFilter:

      https://issues.apache.org/jira/browse/WW-2167

      I was originally using Struts 2.1.8.1 and upgraded to the latest (2.3.1.2) which didn't solve the problem, nor did switching back and forth between the FilterDispatcher and StrutsPrepareAndExecuteFilter.

      I also tried an IntrospectorCleanupListener as a shot in the dark but to no avail.

      If I comment out the StrutsPrepareAndExecuteFilter and deploy/stop the web app, the severe warnings regarding ThreadLocals go away (though obviously my web app no longer works).

      I sought further advice on the Struts 2 user mailing list as well as a couple web forums but didn't get any further suggestions other than to file a bug on JIRA.

      It seems at least a few others are experiencing the same issue. From my experimentation it seems something related to the StrutsPrepareAndExecuteFilter starts off threads on startup but they are not shut down properly. I could not find any documentation on additional cleanup I might perform to force any threads started by struts to shutdown.

      Attachments

        Issue Links

          Activity

            People

              rgielen René Gielen
              tkimzey Tom Kimzey
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: