Intermittent java.net.socketException: Connection timed out (Read Failed) When Running JDBC Application (Doc ID 2849619.1)
JDBC - Version 19.3 and later
information in this document applies to any platform.
SYMPTOMS
JDBC connections with Tibco application fail intermittently with the following exception:
java.lang.RuntimeException: java.sql.sqlRecoverableException: IO Error: Connection timed out (Read Failed)
at com.tibco.be.oracle.functions.OracleCustomFunctions.executeQuery(OracleCustomFunctions.java:262)
at com.tibco.cep.kernel.core.rete.ReteWM.resolveConflict(ReteWM.java:401)
at com.tibco.cep.kernel.core.rete.ReteWM$6.doTxnWork(ReteWM.java:1569)
at com.tibco.cep.kernel.core.rete.BeTransaction.run(BeTransaction.java:141)
at com.tibco.cep.kernel.core.rete.BeTransaction.execute(BeTransaction.java:101)
at com.tibco.cep.kernel.core.rete.ReteWM.executeRules(ReteWM.java:1586)
at com.tibco.cep.runtime.session.impl.RuleSessionImpl$4.doTxnWork(RuleSessionImpl.java:1166)
at com.tibco.cep.kernel.core.rete.BeTransaction.run(BeTransaction.java:141)
at com.tibco.cep.kernel.core.rete.BeTransaction.execute(BeTransaction.java:101)
at com.tibco.cep.runtime.session.impl.RuleSessionImpl.preprocesspassthru(RuleSessionImpl.java:1176)
at com.tibco.cep.runtime.scheduler.impl.DefaultTaskController.processEvent(DefaultTaskController.java:120)
at com.tibco.cep.runtime.scheduler.impl.WorkerBasedControllerV2.superProcessEvent(WorkerBasedControllerV2.java:369)
at com.tibco.cep.runtime.scheduler.impl.WorkerBasedControllerV2$1.doTxnWork(WorkerBasedControllerV2.java:382)
at com.tibco.cep.kernel.core.rete.BeTransaction.run(BeTransaction.java:156)
at com.tibco.cep.kernel.core.rete.BeTransaction.execute(BeTransaction.java:101)
CHANGES
CAUSE
Connection timed out during socketRead.
Connection timed out (Read Failed) means there was a timeout that intercepted the connection while trying to read from the database (socket read).
The exception stack shows connectivity is lost while executing a sql statement:
Caused by: com.tibco.cep.runtime.model.exception.impl.BEExceptionImpl: java.net.socketException: Connection timed out (Read Failed)
at java.net.socketInputStream.socketRead0(Native Method)
at java.net.socketInputStream.socketRead(SocketInputStream.java:116)
at java.net.socketInputStream.read(SocketInputStream.java:171)
at java.net.socketInputStream.read(SocketInputStream.java:141)
at oracle.net.ns.Packet.receive(Packet.java:317)
at oracle.net.ns.DataPacket.receive(DataPacket.java:101)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:301)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:245)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:167)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:119)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:75)
at oracle.jdbc.driver.T4CMAREnginestream.unmarshalUB1(T4CMAREnginestream.java:444)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:402)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:256)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:577)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:239)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:75)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1246)
... 51 more
SOLUTION
1. Enable Oracle Net Dead Connection Detection (DCD) by setting sqlNET.EXPIRE_TIME=10 in the sqlnet.ora file (under RDBMS home not GRID) on the server-side.
AND
2. Set the ENABLE=broKEN clause in the JDBC connection descriptor. Example:
jdbc:oracle:thin:@(DESCRIPTION=(ENABLE=broKEN)(ADDRESS=(PROTOCOL=tcp)(PORT=<PORT>)(HOST=<HOST>))(CONNECT_DATA=(SERVICE_NAME=<SERVICE NAME>)))
其它参考:
[20200220]关于SQLNET.EXPIRE_TIME and ENABLE=BROKEN的总结.txt_ITPUB博客