4

I am getting below log in my old application , i tried to search with .setName as we set thread name using thread.setName method but not able to see it. i doubt it is started by application and i am searching in all .java files.

Jan 30, 2014 1:00:29 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads SEVERE: The web application [/MyWebApp] appears
to have started a thread named [Control] but has failed to stop it.
This is very likely to create a mem ory leak. Jan 30, 2014 1:00:29 AM
org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyWebApp] appears to have started a
thread named [MultiThreadedHttpConnectionManager cleanup] but has
failed to stop it.

Not able to understand where these threads( Control and MultiThreadedHttpConnectionManager ) are getting started so that i can modify code to stop these threads.

Edit: My Colleague answered one part of it , MultiThreadedHttpConnectionManager was BUG in Axis2

When i run tomcat in debug mode i see some daemon threads and two other threads (main,Control). Command line arguments for Control thread are showing "org.apache.catalina.startup.Bootstrap start". Looks like tomcat is starting this thread, but if this is the case why tomcat will give error log for this?

Vipin
  • 4,851
  • 3
  • 35
  • 65
  • Thread name can be set either in `setName` method or using thread constructor see http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#Thread%28java.lang.String%29 – Sajan Chandran Feb 18 '14 at 10:22
  • @SajanChandran I agree with u , but i need to find out way to identify code or class name which is starting that thread – Vipin Feb 18 '14 at 10:45
  • try scanning through your dependencies and google by `[dependency name] control thread`. That might give you some insight – injecteer Feb 18 '14 at 10:47
  • @Vipin search for `new Thread(` in your eclipse. – Sajan Chandran Feb 18 '14 at 10:49
  • @SajanChandran no luck using this :( – Vipin Feb 18 '14 at 11:21
  • @injecteer can you please elaborate which dependency u are talking about. example will be great. – Vipin Feb 18 '14 at 11:22
  • in your `lib` folder or you `maven` descriptor you must be having some `jar` files or references to them. Those are the libraries your project is using to compile/build/runtime. So, using this list, you can fire up the google search – injecteer Feb 18 '14 at 11:24
  • Could it be [Spring](http://forum.spring.io/forum/spring-projects/web-services/106615-multithreadedhttpconnectionmanager-s-thread-isn-t-stopped-when-application-shuts-down)? On the forum it says to "call the static method MultiThreadedHttpConnectionManager.shutdownAll()". – vanOekel Feb 18 '14 at 16:11
  • It is not spring , it is a struts 1.1 application. I am using apache commons lib , axis 1.3 and server is tomcat 6 – Vipin Feb 18 '14 at 16:47
  • Have you tried turning on DEBUG logging for Tomcat and see if it has more info? – Sundeep Feb 19 '14 at 11:37
  • @Sundeep i did not change any setting and i see FINE in logging.properties at several places, what exactly shall i change ? – Vipin Feb 19 '14 at 11:48
  • @Vipin I am no expert in Tomcat, but usually DEBUG logs provide more information. You should turn on DEBUG logging for the tomcat container. In that file, change FINE to DEBUG and see if you get additional info in logs. See if this helps - http://stackoverflow.com/questions/4119213/how-to-set-level-logging-to-debug-in-tomcat-6 – Sundeep Feb 19 '14 at 12:00

2 Answers2

1

I got my answer and 2 simple solutions to this problem

  1. use Kill -QUIT pid to get thread dump and see the stack trace , it gives stack trace and tells what exactly the runnable/Thread class name is.
  2. The other option is to start application in eclipse see get information from debug mode. Where we can see what all threads are running.
Vipin
  • 4,851
  • 3
  • 35
  • 65
0

If your thread is run through ThreadPoolExecutor::runWorker, you can put a conditional breakpoint there on task.run() with the condition wt.name.equals("my-thread-name") and step into the code that created the thread.

Noumenon
  • 5,099
  • 4
  • 53
  • 73