请问这个线程阻塞的原因是什么

Mr_Sky 发布于 2017/10/10 15:03
阅读 524
收藏 0

一个线上应用系统,用户反馈一个提交操作被卡住无响应,threaddump看到很多线程在等待监视器,而监视器被http-0.0.0.0-8080-93 占有,如图

 

这是http-0.0.0.0-8080-93的stacktrace,请问大神们看得出来是什么原因吗

Thread Name
http-0.0.0.0-8080-93
State
Runnable
Monitor
Owns Monitor Lock on 0x76ee5088
Java Stack
at java.net.SocketInputStream.socketRead0(Native Method) 
at java.net.SocketInputStream.read(SocketInputStream.java:129) 
at oracle.net.ns.Packet.receive(Unknown Source) 
at oracle.net.ns.DataPacket.receive(Unknown Source) 
at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source) 
at oracle.net.ns.NetInputStream.read(Unknown Source) 
at oracle.net.ns.NetInputStream.read(Unknown Source) 
at oracle.net.ns.NetInputStream.read(Unknown Source) 
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1104) 
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1075) 
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:480) 
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216) 
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:966) 
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1170) 
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339) 
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3423) 
- locked [0x8367bbc0] (a oracle.jdbc.driver.T4CPreparedStatement) 
- locked [0x7f5c4398] (a oracle.jdbc.driver.T4CConnection) 
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:365) 
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:165) 
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1163) 
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:334) 
at com.tourism.common.dao.hibernate.TourismSeqNumHibernate.updateSeqNum(TourismSeqNumHibernate.java:54) 
- locked [0x76ee5088] (a java.lang.Object) 
at com.tourism.common.dao.hibernate.TourismSeqNumHibernate.getSeqNum(TourismSeqNumHibernate.java:30) 
at com.tourism.gl.airorder.prepareorder.dao.impl.PrepareOrderDaoImpl.getOrderId(PrepareOrderDaoImpl.java:137) 
at com.tourism.gl.airorder.prepareorder.dao.impl.PrepareOrderDaoImpl.insertOrder(PrepareOrderDaoImpl.java:37) 
at com.tourism.gl.airorder.prepareorder.service.impl.AirTicketServiceImpl.saveYdd(AirTicketServiceImpl.java:1025) 
at sun.reflect.GeneratedMethodAccessor4885.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:291) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:180) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:147) 
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) 
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:169) 
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:169) 
at com.sun.proxy.$Proxy108.saveYdd(Unknown Source) 
at com.tourism.gl.airorder.prepareorder.action.TxyddAction.execute(TxyddAction.java:482) 
at com.web.struts.BAction.execute(BAction.java:65) 
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) 
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) 
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) 
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at com.tourism.common.filter.OperationTrackFilterGL.doFilter(OperationTrackFilterGL.java:37) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at com.cas.client.sso.j2ee.filter.CasAuthenticationFilter.doFilter(CasAuthenticationFilter.java:124) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at com.web.filter.ChangeCharsetFilter.doFilter(ChangeCharsetFilter.java:36) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 
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:230) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182) 
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) 
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) 
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) 
at java.lang.Thread.run(Thread.java:662) 
Native Stack
No Native stack trace available

加载中
0
尚浩宇
尚浩宇

看样子像数据库拖住了,那个请求查询数据库,数据库无响应,连接一直处理等待

Mr_Sky
Mr_Sky
执行的是update语句,发现数据库有锁表。有办法从数据库被锁的表,反查是哪个java线程导致的吗?
尚浩宇
尚浩宇
@Mr_Sky 回复@Mr_Sky : 跟一下代码,找到查得哪个库哪张表,然后拿着sql去执行一次看看是不是慢sql
Mr_Sky
Mr_Sky
我也是怀疑这里at java.net.SocketInputStream.socketRead0(Native Method) ,但是无法进一步查找原因
0
polly
polly

at com.tourism.common.dao.hibernate.TourismSeqNumHibernate.getSeqNum(TourismSeqNumHibernate.java:30) 

查这里,看是否有死锁

Mr_Sky
Mr_Sky
确实有,但是要进一步找原因
返回顶部
顶部