로그인

Language :
Title톰캣 쓰레드 덤프 뜨기
tomcat thread dump
WriterJi-Seob LeeWrite DateApr 29 2018Modify DateMay 17 2026View Count8228

This is guide to dump Tomcat thread.

 

Basically, under the Tomcat home, under the webapps,

there must be manager directory.

This directory is provided basically by Tomcat.

 

The object is

http://localhost/manager/text/threaddump

Like above, in web browser view the thread dump.

 

1)  Process 1.

  Modify the below xml file.

  TOMCAT_HOME/webapps/manager/META-INF/context.xml

 

<Context antiResourceLocking="false" privileged="true" >
  <CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
                   sameSiteCookies="strict" />
  <Valve className="org.apache.catalina.valves.RemoteCIDRValve"
         allow="127.0.0.0/8,::1/128" />
  <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>

 →

<Context antiResourceLocking="false" privileged="true" >
  <CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
                   sameSiteCookies="strict" />
  <Valve className="org.apache.catalina.valves.RemoteCIDRValve"
         allow="0.0.0.0/0,::/0" />
  <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>

  This make all IPs accessible to dump thread. 

  Before this only 127.0.0.1, localhost has access to dump thread.

 

2)  Process 2.

  Modify below xml file.

  TOMCAT_HOME/conf/tomcat-users.xml

 

  Add below two line to the tomcat-users tag in this xml file.

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat10" password="password Input" roles="manager-gui,manager-script"/>

 

  http://localhost/manager/text/threaddump

  The dump program runs as manager-script provileges.

  So add the role and user.

 

 
Repeatedly,
 
  TOMCAT_HOME/webapps/manager/META-INF/context.xml   : configure accessible IPs

  TOMCAT_HOME/conf/tomcat-users.xml   : configure previleges
 
After above two configuration,

 

http://localhost/manager/text/threaddump

or

http://localhost:8080/manager/text/threaddump
 
By call a URL like above we can view Tomcat thread dump.
 
First, go to http://localhost:8080/manager to check the current status.
 
To view the content we must input ID and Password,
 
this is in the tomcat-users.xml file, above 2).
 
 

The dump content like below.

OK - JVM thread dump
2018-04-29 18:02:06.791
Full thread dump Java HotSpot(TM) 64-Bit Server VM (9.0.1+11 mixed mode):

"Abandoned connection cleanup thread" Id=45 cpu=603854 ns usr=0 ns blocked 1 for -1 ms waited 3 for -1 ms
   java.lang.Thread.State: TIMED_WAITING
	locks java.util.concurrent.ThreadPoolExecutor$Worker@ddd6377
	at java.base@9.0.1/java.lang.Object.wait(Native Method)
	- waiting on (a java.lang.ref.ReferenceQueue$Lock@4fa28c62)
	at java.base@9.0.1/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
	at com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
	at java.base@9.0.1/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.base@9.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.base@9.0.1/java.lang.Thread.run(Thread.java:844)

"ajp-nio-8009-AsyncTimeout" Id=43 cpu=264727 ns usr=0 ns blocked 0 for -1 ms waited 8 for -1 ms
   java.lang.Thread.State: TIMED_WAITING
	at java.base@9.0.1/java.lang.Thread.sleep(Native Method)
	at org.apache.coyote.AbstractProtocol$AsyncTimeout.run(AbstractProtocol.java:1133)
	at java.base@9.0.1/java.lang.Thread.run(Thread.java:844)

"ajp-nio-8009-Acceptor-0" Id=42 cpu=4483464 ns usr=0 ns blocked 0 for -1 ms waited 0 for -1 ms (running in native)
   java.lang.Thread.State: RUNNABLE
	at java.base@9.0.1/sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
	at java.base@9.0.1/sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:424)
	at java.base@9.0.1/sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:252)
	- locked (a java.lang.Object@7346f5be) index 2 frame java.base@9.0.1/sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:252)
	at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:455)
	at java.base@9.0.1/java.lang.Thread.run(Thread.java:844)

...
...
...

Comment

Name               Password 
Content
개인정보 처리방침