Spring app throw java.sql.SQLRecoverableException:Closed Connection

时间:2015-06-17 15:36:28

标签: spring

按周计划(不在任何App服务器上)长时间运行独立Spring应用程序通常需要几天才能完成但由于java.net.SocketException而失败:管道损坏。

此处的堆栈跟踪:

Caused by: java.sql.SQLRecoverableException: IO Error: Broken pipe
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:876)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3620)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
    at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:703)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
    ... 28 more

Caused by: java.net.SocketException: Broken pipe
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
    at oracle.net.ns.DataPacket.send(DataPacket.java:199)
    at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:211)
    at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:227)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:175)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:100)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
    at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:123)
    at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:79)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1122)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1099)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:288)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:863)

1 个答案:

答案 0 :(得分:2)

java.net.SocketException: Broken pipe异常表示,您正在编写而另一端已关闭连接。因为另一端没有读它。正如我所说,如果发生这种情况,您的应用程序协议规范或实现会出现问题,很可能您甚至没有。

如果应用程序处理大量数据,请考虑JVM内存问题。另一种可能性是连接的另一端没有等待足够长的时间然后关闭连接,因为应用程序花费太长时间来准备数据并发送。连接超时。

阅读this文章以了解更多信息。