1. ホーム
  2. Database

SocketTimeoutExceptionが発生しました。読み取りがタイムアウトした問題のトラブルシューティング

2022-02-08 17:24:58
問題のログ
java.sql.SQLException: I/O Error: Read timed out
	at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1053) ~[jtds-1.2.5.jar:1.2.5]
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:465) ~[jtds-1.2.5.jar:1.2.5]
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1304) ~[jtds-1.2.5.jar:1.2.5]
	at net.sf.log4jdbc.sql.jdbcapi.StatementSpy.executeQuery(StatementSpy.java:731) ~[log4jdbc-log4j2-jdbc4-1.16.jar:na]
	at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:73) [c3p0-0.9.1.2.jar:0.9.1.2 ]
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection( C3P0PooledConnectionPool.java:374) [c3p0-0.9.1.2.jar:0.9.1.2]
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource( C3P0PooledConnectionPool.java:310) [c3p0-0.9.1.2.jar:0.9.1.2]
	at com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:1999) [c3p0-0.9.1.2.jar:0.9. 1.2]
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) [c3p0-0.9.1.2.jar:0.9.1.2 ]
Caused by: java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.6.0_43]
	at java.net.SocketInputStream.read(SocketInputStream.java:129) ~[na:1.6.0_43]
	at java.io.DataInputStream.readFully(DataInputStream.java:178) ~[na:1.6.0_43]
	at java.io.DataInputStream.readFully(DataInputStream.java:152) ~[na:1.6.0_43]
	at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:846) ~[jtds-1.2.5.jar:1.2.5]
	at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:727) ~[jtds-1.2.5.jar:1.2.5]
	at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:466) ~[jtds-1.2.5.jar:1.2.5]
	at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:103) ~[jtds-1.2.5.jar:1.2.5]
	at net.sourceforge.jtds.jdbc.ResponseStream.peek(ResponseStream.java:88) ~[jtds-1.2.5.jar:1.2.5]
	at net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.java:3932) ~[jtds-1.2.5.jar:1.2.5]
	at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1046) ~[jtds-1.2.5.jar:1.2.5]
	... 8 common frames omitted
2018-07-04 01:07:43 [ERROR] [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] jdbc.sqltiming - 221. connection. getAutoCommit()

通常は、データベース接続の問題、接続されていない、またはネットワークの問題(ネットワークの変動)です。

サーバーのjdbcログを確認し、read timed out例外が連続的ではなく、断続的であることを見つけ、しばらくライブラリをチェックし、しばらくするとまたライブラリが壊れる 。