C3P0经常出现ResultSet close FAILED.这是数据库死锁导致的吗

qyj 发布于 2013/08/14 10:32
阅读 1K+
收藏 0

异常如下,有知道的麻烦告知下!

[10:06:43:279][WARN](com.mchange.v1.db.sql.ResultSetUtils:60) - ResultSet close FAILED.

com.microsoft.sqlserver.jdbc.SQLServerException: 使用 DBComms.receive 方法期间发生异常。操作:socket closed。上下文:(44) [Thread[C3P0PooledConnectionPoolManager[identityToken->1ji4wb48wy0aojw17jxs6r|176cad3]-HelperThread-#2,5,main], IO:307ae, Dbc:d473d]。PktNum:0。TotalReceived:0。PktSize:4,096。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
at com.microsoft.sqlserver.jdbc.DBComms.receive(Unknown Source)
at com.microsoft.sqlserver.jdbc.DBComms.receive(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doCloseServerCursor(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$CloseServerCursorRequest.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.closeServerCursor(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.close(Unknown Source)
at com.mchange.v1.db.sql.ResultSetUtils.attemptClose(ResultSetUtils.java:53)
at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:123)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:509)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.testPooledConnection(C3P0PooledConnectionPool.java:463)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishIdleResource(C3P0PooledConnectionPool.java:435)
at com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:2151)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648)
加载中
0
xmdeepdata
xmdeepdata

几种可能的原因再试着检查下吧
1、数据库在另一台服务器上,网络连接出现丢包导致数据库连接中断(可能性较小)
2、数据库链接保持超过一定时间,c3p0自动关闭连接(检查配置和连接时间)
3、程序逻辑问题,共享了连接,但是被其他程序给占用了

0
qyj
qyj
连接我使用完就释放了:
public void closeConnection() {
Connection connection = threadLocal.get();
try {
if (connection != null && !connection.isClosed()) {
connection.close();
threadLocal.set(null);
}
} catch (SQLException e) {
log.error(e.getMessage(), e);
}

}

数据库是在另一台服务器上,但是和我的机器是局域网。

我查了这个异常:
com.microsoft.sqlserver.jdbc.SQLServerException: 使用 DBComms.receive 方法期间发生异常。操作:socket closed。上下文:(44) [Thread[C3P0PooledConnectionPoolManager[identityToken->1ji4wb48wy0aojw17jxs6r|176cad3]-HelperThread-#2,5,main], IO:307ae, Dbc:d473d]。PktNum:0。TotalReceived:0。PktSize:4,096。

网上很多都说是数据库死锁导致的,但是数据库还能正常操作!

0
xmdeepdata
xmdeepdata

换驱动试下,jdts


返回顶部
顶部