A thread was hanged on java.net.SocketInputStream.

2019-05-21 17:33发布

问题:

 "[GMQMsgConsumeThread:113.105.152.146:22300, queue:Q_COOMIX_IMG_META]" prio=10 tid=0x08431000 nid=0x774c runnable [0x6e6b5000]
       java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
        at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
        at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
        - locked <0x83f593e0> (a com.mysql.jdbc.util.ReadAheadInputStream)
        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1910)
        at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:501)
        at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:379)
        at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1970)
        at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1387)
        at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1195)
        - locked <0x83f596a0> (a java.lang.Object)
        at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:693)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1266)
        - locked <0x83f596a0> (a java.lang.Object)
        at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
        at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
    .........
    .........

       Locked ownable synchronizers:
        - None

The relational environment as follows:

mysql: 5.1.56 mysql jdbc driver: MySQL Connector/J 5.0.4 DBCP 1.4

Any ideas on what could be the cause?

thanks

回答1:

This is caused by a deadlock. There is an uncommited data trying to be read. Im my case the data was on database schema, since the operations I was trying to do is an ALTER TABLE.