简体   繁体   中英

JDBC4Connection and JDBC4PreparedStatement locked

I've a thread dump that has a lot of threads that show locked JDBC4Connection and JDBC4PreparedStatement.Why too many threads are showing locked connection and prepared statement ...

"ajp-bio-14009-exec-606" daemon prio=10 tid=0x00007f625405f800 nid=0x2f88 runnable [0x00007f61cfaf7000]
   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:114)
    at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
    at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
    - locked <0x00000006f1111988> (a com.mysql.jdbc.util.ReadAheadInputStream)
    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2537)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2990)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2979)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3520)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
    - locked <0x00000006f11113e8> (a com.mysql.jdbc.JDBC4Connection)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
    - locked <0x00000006d593e3e8> (a com.mysql.jdbc.JDBC4PreparedStatement)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
    - locked <0x00000006f11113e8> (a com.mysql.jdbc.JDBC4Connection)
    - locked <0x00000006d593e3e8> (a com.mysql.jdbc.JDBC4PreparedStatement)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
    - locked <0x00000006d593e3e8> (a com.mysql.jdbc.JDBC4PreparedStatement)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
    at com.appnetix.app.util.QueryUtil.update(QueryUtil.java:534)

It happens because MySql JDBC driver contains a lot of synchronized blocks. Your threads are not locked on sync blocks. They acquire necessary locks and wait on I/O.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM