Tomcat 7在没有连接的情况下启动时CPU使用率很高

时间:2013-01-24 02:07:08

标签: java tomcat cpu netty hornetq

我们在CentOS 6.3上运行Tomcat 7.0.34(完全修补),并且一旦服务器启动,我们所有应用程序服务器的CPU都会飙升。没有与Tomcat建立连接。看来有一些CPU核心被我们的webapp内部运行的东西完全占用。

我不能为我的生活找出可能导致这个问题的原因。有没有人见过这个?

我应该提到这只发生在CentOS盒子上。我的Windows tomcat服务器不会出现运行相同应用程序的此行为。

相关技术

我们正在使用Tomcat的会话复制,Replicated EHCache和HornetQ for JMS。

经过测试的Java版本

JDK 1.7.0 Update 10和JDK 1.6.0 Update 38

杀死-3个可运行的主题

    "http-apr-8080-Acceptor-1" daemon prio=10 tid=0x00007f2598183000 nid=0x46b9 runnable [0x00007f2500685000]
       java.lang.Thread.State: RUNNABLE
            at org.apache.tomcat.jni.Socket.accept(Native Method)
            at org.apache.tomcat.util.net.AprEndpoint$Acceptor.run(AprEndpoint.java:1013)
            at java.lang.Thread.run(Thread.java:722)

    "http-apr-8080-Acceptor-0" daemon prio=10 tid=0x00007f2598181800 nid=0x46b8 runnable [0x00007f2500786000]
       java.lang.Thread.State: RUNNABLE
            at org.apache.tomcat.jni.Socket.accept(Native Method)
            at org.apache.tomcat.util.net.AprEndpoint$Acceptor.run(AprEndpoint.java:1013)
            at java.lang.Thread.run(Thread.java:722)

    "New I/O boss #26" daemon prio=10 tid=0x00007f253d4fb000 nid=0x462f runnable [0x00007f250c49c000]
       java.lang.Thread.State: RUNNABLE
            at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
            at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
            at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:81)
            at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
            - locked <0x00000006ab002568> (a sun.nio.ch.Util$2)
            - locked <0x00000006ab002558> (a java.util.Collections$UnmodifiableSet)
            - locked <0x00000006ab0024d0> (a sun.nio.ch.EPollSelectorImpl)
            at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
            at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:64)
            at org.jboss.netty.channel.socket.nio.AbstractNioSelector.select(AbstractNioSelector.java:409)
            at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:206)
            at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:41)
            at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
            at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
            at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
            at java.lang.Thread.run(Thread.java:722)

    "New I/O worker #25" daemon prio=10 tid=0x00007f253d4e4000 nid=0x462e runnable [0x00007f250c59d000]
       java.lang.Thread.State: RUNNABLE
            at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
            at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
            at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:81)
            at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
            - locked <0x00000006aefbcab8> (a sun.nio.ch.Util$2)
            - locked <0x00000006aefbcaa8> (a java.util.Collections$UnmodifiableSet)
            - locked <0x00000006aefbca60> (a sun.nio.ch.EPollSelectorImpl)
            at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
            at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:64)
            at org.jboss.netty.channel.socket.nio.AbstractNioSelector.select(AbstractNioSelector.java:409)
            at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:206)
            at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
            at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
            at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
            at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
            at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
            at java.lang.Thread.run(Thread.java:722)

    "New I/O worker #24" daemon prio=10 tid=0x00007f253d4b9000 nid=0x462d runnable [0x00007f250c69e000]
       java.lang.Thread.State: RUNNABLE
            at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
            at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
            at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:81)
            at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
            - locked <0x00000006ab002c70> (a sun.nio.ch.Util$2)
            - locked <0x00000006ab002c60> (a java.util.Collections$UnmodifiableSet)
            - locked <0x00000006ab002bd8> (a sun.nio.ch.EPollSelectorImpl)
            at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
            at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:64)
            at org.jboss.netty.channel.socket.nio.AbstractNioSelector.select(AbstractNioSelector.java:409)
            at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:206)
            at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
            at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
            at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
            at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
            at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
            at java.lang.Thread.run(Thread.java:722)

... ABOUT 20 MORE NIO WORKERS IN RUNNABLE STATE...

"New I/O worker #2" prio=10 tid=0x00007f253d054000 nid=0x4616 runnable [0x00007f250ddb5000]
   java.lang.Thread.State: RUNNABLE
        at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
        at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
        at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:81)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
        - locked <0x00000006adaa7070> (a sun.nio.ch.Util$2)
        - locked <0x00000006adaa7060> (a java.util.Collections$UnmodifiableSet)
        - locked <0x00000006adaa6fd8> (a sun.nio.ch.EPollSelectorImpl)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
        at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:64)
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.select(AbstractNioSelector.java:409)
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:206)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
        at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

"New I/O worker #1" prio=10 tid=0x00007f253d053000 nid=0x4615 runnable [0x00007f250deb6000]
   java.lang.Thread.State: RUNNABLE
        at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
        at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
        at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:81)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
        - locked <0x00000006adaa7bc0> (a sun.nio.ch.Util$2)
        - locked <0x00000006adaa7bb0> (a java.util.Collections$UnmodifiableSet)
        - locked <0x00000006adaa7b28> (a sun.nio.ch.EPollSelectorImpl)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
        at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:64)
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.select(AbstractNioSelector.java:409)
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:206)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
        at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

"NamingBootstrap Pool(1)-1" daemon prio=10 tid=0x00007f253c4f8800 nid=0x45fc runnable [0x00007f25842a3000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at org.jnp.server.Main$AcceptHandler.run(Main.java:481)
        at org.jboss.util.threadpool.RunnableTaskWrapper.run(RunnableTaskWrapper.java:148)
        at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:722)

"RMI TCP Accept-1098" daemon prio=10 tid=0x00007f253c4f4800 nid=0x45fb runnable [0x00007f25843a4000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:359)
        at java.lang.Thread.run(Thread.java:722)

"RMI TCP Accept-0" daemon prio=10 tid=0x00007f253cc2d800 nid=0x45e6 runnable [0x00007f25859b9000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:359)
        at java.lang.Thread.run(Thread.java:722)

"RMI TCP Accept-40001" daemon prio=10 tid=0x00007f253cc16000 nid=0x45da runnable [0x00007f25865c5000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:359)
        at java.lang.Thread.run(Thread.java:722)

"Multicast Heartbeat Receiver Thread" daemon prio=10 tid=0x00007f253cc18000 nid=0x45d8 runnable [0x00007f25867c7000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainDatagramSocketImpl.receive0(Native Method)
        - locked <0x00000006ab145b28> (a java.net.PlainDatagramSocketImpl)
        at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:145)
        - locked <0x00000006ab145b28> (a java.net.PlainDatagramSocketImpl)
        at java.net.DatagramSocket.receive(DatagramSocket.java:786)
        - locked <0x000000067ffd9240> (a java.net.DatagramPacket)
        - locked <0x00000006ab1459f0> (a java.net.MulticastSocket)
        at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatReceiver$MulticastReceiverThread.run(MulticastKeepaliveHeartbeatReceiver.java:124)

"Tribes-MembershipReceiver" daemon prio=10 tid=0x00007f259895c800 nid=0x45d0 runnable [0x00007f258733a000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainDatagramSocketImpl.receive0(Native Method)
        - locked <0x00000006b8163208> (a java.net.PlainDatagramSocketImpl)
        at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:145)
        - locked <0x00000006b8163208> (a java.net.PlainDatagramSocketImpl)
        at java.net.DatagramSocket.receive(DatagramSocket.java:786)
        - locked <0x00000006b8158768> (a java.net.DatagramPacket)
        - locked <0x00000006b7b4fc30> (a java.net.MulticastSocket)
        at org.apache.catalina.tribes.membership.McastServiceImpl.receive(McastServiceImpl.java:340)
        at org.apache.catalina.tribes.membership.McastServiceImpl$ReceiverThread.run(McastServiceImpl.java:534)

"NioReceiver" daemon prio=10 tid=0x00007f259892f000 nid=0x45cf runnable [0x00007f258743b000]
   java.lang.Thread.State: RUNNABLE
        at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
        at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
        at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:81)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
        - locked <0x00000006b8155008> (a sun.nio.ch.Util$2)
        - locked <0x00000006b8155020> (a java.util.Collections$UnmodifiableSet)
        - locked <0x00000006b78650a8> (a sun.nio.ch.EPollSelectorImpl)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
        at org.apache.catalina.tribes.transport.nio.NioReceiver.listen(NioReceiver.java:281)
        at org.apache.catalina.tribes.transport.nio.NioReceiver.run(NioReceiver.java:420)
        at java.lang.Thread.run(Thread.java:722)

"NioReceiver" daemon prio=10 tid=0x00007f259892f000 nid=0x45cf runnable [0x00007f258743b000]
   java.lang.Thread.State: RUNNABLE
        at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
        at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228)
        at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:81)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
        - locked <0x00000006b8155008> (a sun.nio.ch.Util$2)
        - locked <0x00000006b8155020> (a java.util.Collections$UnmodifiableSet)
        - locked <0x00000006b78650a8> (a sun.nio.ch.EPollSelectorImpl)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
        at org.apache.catalina.tribes.transport.nio.NioReceiver.listen(NioReceiver.java:281)
        at org.apache.catalina.tribes.transport.nio.NioReceiver.run(NioReceiver.java:420)
        at java.lang.Thread.run(Thread.java:722)

"RMI TCP Accept-0" daemon prio=10 tid=0x00007f25982e0800 nid=0x45cc runnable [0x00007f258c7a6000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(LocalRMIServerSocketFactory.java:52)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:359)
        at java.lang.Thread.run(Thread.java:722)

"RMI TCP Accept-9004" daemon prio=10 tid=0x00007f25982cb000 nid=0x45cb runnable [0x00007f258c8a7000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:359)
        at java.lang.Thread.run(Thread.java:722)

"RMI TCP Accept-0" daemon prio=10 tid=0x00007f25982a7000 nid=0x45ca runnable [0x00007f258c9a8000]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:387)
        at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:359)
        at java.lang.Thread.run(Thread.java:722)

"Service Thread" daemon prio=10 tid=0x00007f259817a800 nid=0x45c9 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" daemon prio=10 tid=0x00007f2598178000 nid=0x45c8 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" daemon prio=10 tid=0x00007f2598175800 nid=0x45c7 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=10 tid=0x00007f2598173800 nid=0x45c6 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Surrogate Locker Thread (Concurrent GC)" daemon prio=10 tid=0x00007f2598171800 nid=0x45c5 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"VM Thread" prio=10 tid=0x00007f259811c000 nid=0x45c2 runnable

"Gang worker#0 (Parallel GC Threads)" prio=10 tid=0x00007f2598012000 nid=0x45bd runnable

"Gang worker#1 (Parallel GC Threads)" prio=10 tid=0x00007f2598014000 nid=0x45be runnable

"Gang worker#2 (Parallel GC Threads)" prio=10 tid=0x00007f2598015800 nid=0x45bf runnable

"Gang worker#3 (Parallel GC Threads)" prio=10 tid=0x00007f2598017800 nid=0x45c0 runnable

"Concurrent Mark-Sweep GC Thread" prio=10 tid=0x00007f25980a6800 nid=0x45c1 runnable
"VM Periodic Task Thread" prio=10 tid=0x00007f25982e3000 nid=0x45cd waiting on condition

对于刚刚启动的服务器,没有复制对等体,并且尚未接受任何请求,所有这些似乎非常繁忙。

想法?

1 个答案:

答案 0 :(得分:2)

看起来就像JVM正在做与网络相关的事情。我会尝试以下内容,看看他们是否有任何线索:

  • 使用数据包监视器查看以太网或环回上是否有传入/传出网络流量。

  • 使用strace查看JVM正在进行的系统调用

  • 检查Tomcat日志文件。并且作为实验更改日志记录配置,以便您可以查看所有DEBUG日志记录。

  • 检查系统日志,包括安全日志(如果您启用了SELinux。)

您也可以尝试调整tomcat配置以不使用APR,看看是否有任何区别。