Description:
mysql connector/J driver in streaming mode will in the blocking state and not return.
Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test", "root", "hello");
Statement st = conn.createStatement();
st.setFetchSize(Integer.MIN_VALUE); // import
ResultSet rs = null;
try {
rs = st.executeQuery("select 1+18446744073709551615");
rs.next();
} catch (Throwable e) {
e.printStackTrace();// com.mysql.jdbc.MysqlDataTruncation: Data truncation: BIGINT UNSIGNED value is out of range in '(1 + 18446744073709551615)'
rs.close(); // will block
st.close();
conn.close();
}
rs.close() method will in the blocking state (wait for RowDataDynamic.nextRecord() )
execute sql is fine in non-streaming mode.
-----
java stack.
"main" prio=5 tid=0x00007fa73c00c800 nid=0x1903 runnable [0x0000000110b1e000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:100)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:143)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:173)
- locked <0x00000007d6086880> (a com.mysql.jdbc.util.ReadAheadInputStream)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2911)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3337)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3327)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:870)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1928)
at com.mysql.jdbc.RowDataDynamic.nextRecord(RowDataDynamic.java:378)
at com.mysql.jdbc.RowDataDynamic.next(RowDataDynamic.java:358)
at com.mysql.jdbc.RowDataDynamic.close(RowDataDynamic.java:158)
- locked <0x00000007d5d467e0> (a com.mysql.jdbc.JDBC4Connection)
at com.mysql.jdbc.ResultSetImpl.realClose(ResultSetImpl.java:6702)
- locked <0x00000007d5d467e0> (a com.mysql.jdbc.JDBC4Connection)
at com.mysql.jdbc.ResultSetImpl.close(ResultSetImpl.java:842)
How to repeat:
run test code.