Code Bye

求助,几个死锁栈信息,BLOCKED (on object monitor)

 

环境: apache2+tomcat6
状况:web程序访问慢或者无法打开页面
以下是当时抓到的部分栈信息,请路过的朋友帮忙分析一下,小弟先谢过了。

==========下面这类 blocked 存在 169 处。
“TP-Processor498” daemon prio=10 tid=0x00002aaab8903800 nid=0x31a waiting for monitor entry [0x000000004aadf000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration$RuntimeConfigurationImpl.getActionConfig(DefaultConfiguration.java:379)
– waiting to lock <0x00002aab307a61f0> (a com.opensymphony.xwork2.config.impl.DefaultConfiguration$RuntimeConfigurationImpl)
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:161)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at co.common.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:38)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)

==========下面这类 blocked 存在 46处。
“Thread-11226” daemon prio=10 tid=0x000000005e32d800 nid=0x4c5 waiting for monitor entry [0x000000004b139000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.log4j.Category.callAppenders(Category.java:204)
– waiting to lock <0x00002aab2f555948> (a org.apache.log4j.spi.RootLogger)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.info(Category.java:666)
at com.net263.ma.socket.protocol.openfire.OpenfireClientImpl.imAddUser(OpenfireClientImpl.java:35)
at com.net263.ma.serviceImpl.domainInfoManage.SyncServiceImpl$syncUser.run(SyncServiceImpl.java:213)
at com.net263.ma.socket.client.ThreadPool.run(ThreadPool.java:250)
at java.lang.Thread.run(Thread.java:619)

=====
“TP-Processor467” daemon prio=10 tid=0x00002aaab955c800 nid=0x2fa waiting for monitor entry [0x000000004a300000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at java.lang.reflect.Method.copy(Method.java:143)
at java.lang.reflect.ReflectAccess.copyMethod(ReflectAccess.java:118)
at sun.reflect.ReflectionFactory.copyMethod(ReflectionFactory.java:282)
at java.lang.Class.copyMethods(Class.java:2748)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.springframework.util.ReflectionUtils.findMethod(ReflectionUtils.java:150)
at org.springframework.util.ClassUtils.getMostSpecificMethod(ClassUtils.java:699)
。。。
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)

==========
“Thread-107061” daemon prio=10 tid=0x00002aaab8407000 nid=0x1c3b waiting for monitor entry [0x00000000403c7000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at oracle.jdbc.driver.T4CMAREngine.unmarshalDALC(T4CMAREngine.java:2347)
at oracle.jdbc.driver.T4C8TTIuds.unmarshal(T4C8TTIuds.java:134)
at oracle.jdbc.driver.T4CTTIdcb.receiveCommon(T4CTTIdcb.java:155)
at oracle.jdbc.driver.T4CTTIdcb.receive(T4CTTIdcb.java:115)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:705)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:810)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)
– locked <0x00002aab2dd48ec0> (a oracle.jdbc.driver.T4CPreparedStatement)
– locked <0x00002aab427ea5b8> (a oracle.jdbc.driver.T4CConnection)
at com.jolbox.bonecp.PreparedStatementHandle.executeQuery(PreparedStatementHandle.java:149)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2232)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2124)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1597)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
at com.net263.ma.daoImpl.domainInfoManage.XmailtaskinfoDaoImpl.getInfoBySeq(XmailtaskinfoDaoImpl.java:61)
at com.net263.ma.serviceImpl.domainInfoManage.XmailtaskinfoServiceImpl.getInfoBySeq(XmailtaskinfoServiceImpl.java。。。。。。。。com.net263.ma.serviceImpl.domainInfoManage.XmailtaskinfoServiceImpl$$EnhancerByCGLIB$$4a75904d.getInfoBySeq(<generated>)
at com.net263.ma.socket.protocol.mss.SendNoticeMailTask.run(SendNoticeMailTask.java:40)
at java.lang.Thread.run(Thread.java:619)


20分
这是Thread Dump
该线程状态 waiting for monitor entry 表示目前线程正在等待去锁住一个对象(其它线程可能正拥有该对象锁)。该现象会发生在当多线程同时去执行同步代码块或方法时。注意锁是对对象而言的,而不是单个的方法,也就是说当一个线程去执行某个对象的同步方法时,它须先锁住那个对象。

20分
不够,你要找出所有Thread栈信息,并且分类排序,比如:

因为log4j等待Logger的而阻塞的有多少条线程,这种:
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.log4j.Category.callAppenders(Category.java:204)
– waiting to lock <0x00002aab2f555948> (a org.apache.log4j.spi.RootLogger)

因为JDBC操作等待数据库返回的有多少条线程,这种:
ava.lang.Thread.State: BLOCKED (on object monitor)
at oracle.jdbc.driver.T4CMAREngine.unmarshalDALC(T4CMAREngine.java:2347)
at oracle.jdbc.driver.T4C8TTIuds.unmarshal(T4C8TTIuds.java:134)
at oracle.jdbc.driver.T4CTTIdcb.receiveCommon(T4CTTIdcb.java:155)

然后根据数量规模排序,来判断瓶颈可能发生的位置。

引用 2 楼  的回复:

不够,你要找出所有Thread栈信息,并且分类排序,比如:

因为log4j等待Logger的而阻塞的有多少条线程,这种:
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.log4j.Category.callAppenders(Category.java:204)
– waiting to lock ……

不好意思没有来得及回复,
发现好多是parking to wait for  <0x00002aaad3d8a1a0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) 
查询一些解决办法是 调整jvm的-Xms参数。

http://www.cnblogs.com/softidea/p/4242528.html

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明求助,几个死锁栈信息,BLOCKED (on object monitor)