 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Amos B Guest
|
Posted: Thu Oct 19, 2006 9:15 pm Post subject: Oracle JDBC hangs on socket read |
|
|
Hi,
I've run into this issue multiple times with no solution yet.
For different reasons, the connection between the java application and
the oracle server may drop. This can happen because the network
interface was stopped and started or because of a firewall.
The problem is that when the network connection drops for the above
reasons, the jdbc connections can get stuck while trying to read from a
socket. These connection hang forever. Highly annoying.
Is there anyway to configure the timeout value of the socket used by
the JDBC driver?
Here is an example stack trace:
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at oracle.net.ns.Packet.receive(Unknown Source)
at oracle.net.ns.DataPacket.receive(Unknown Source)
at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:971)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:941)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:432)
at
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
at
oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:543)
at
oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:915)
at
oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
at
oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2929)
- locked <0x5b9005d8> (a oracle.jdbc.driver.T4CPreparedStatement)
- locked <0x5c246760> (a oracle.jdbc.driver.T4CConnection) |
|
| Back to top |
|
 |
joeNOSPAM@BEA.com Guest
|
Posted: Fri Oct 20, 2006 12:22 am Post subject: Re: Oracle JDBC hangs on socket read |
|
|
On Oct 19, 9:15 am, "Amos B" <amos...@gmail.com> wrote:
| Quote: | Hi,
I've run into this issue multiple times with no solution yet.
For different reasons, the connection between the java application and
the oracle server may drop. This can happen because the network
interface was stopped and started or because of a firewall.
The problem is that when the network connection drops for the above
reasons, the jdbc connections can get stuck while trying to read from a
socket. These connection hang forever. Highly annoying.
Is there anyway to configure the timeout value of the socket used by
the JDBC driver?
Here is an example stack trace:
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at oracle.net.ns.Packet.receive(Unknown Source)
at oracle.net.ns.DataPacket.receive(Unknown Source)
at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:971)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:941)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:432)
at
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
at
oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:543)
at
oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement..java:915)
at
oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
at
oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2929)
- locked <0x5b9005d8> (a oracle.jdbc.driver.T4CPreparedStatement)
- locked <0x5c246760> (a oracle.jdbc.driver.T4CConnection)
|
Hi. You have some options:
0 - Have you tried calling Statement.setQueryTimeout()?
1 - Alter your OS's TCP timeout so it notifies the socket
sooner than the default TCP timout (usually 5 minutes).
If your thread hangs much longer, then it's a serious firewall
problem, where it keeps the client-side socket open, but
simply stops passing stuff to it or from it...
2 - If you get Oracle's latest driver (10.2) and decompile it to
find some undocumented methods/interfaces. There is an
abort() method on the connection. If you cast your connection
to the right class/interface you can call that method, which
will close the connection/socket without being blocked by
the hanging thread, and you can clear it up that way.
Joe Weinstein at BEA |
|
| Back to top |
|
 |
Amos B Guest
|
Posted: Fri Oct 20, 2006 6:55 pm Post subject: Re: Oracle JDBC hangs on socket read |
|
|
Thanks!! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|