Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle 11g connection reset error

Am seeing the below error while trying to connect to Oracle 11g on Red Hat Linux, 64-bit using thin jdbc drivers. Would highly appreciate if anyone can throw more light on how to go about troubleshooting this.

 Caused by: java.net.SocketException: Connection reset
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    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.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366)
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:366)
like image 669
John C Avatar asked Mar 17 '13 19:03

John C


3 Answers

You didn't include any details of the problem like what changed? Is this a new configuration for you or did it suddenly stop working? Do you know if you have enough connections available? Does this happen to every connection or is it intermittent?

Considering the error is occurring during the logon process, a few possibilities are:

  1. Network fault
  2. You have exhausted the maximum # of connections, so Oracle hangs up on you.
  3. Firewall restrictions
  4. A problem with the database server or the listener. The processing serving your session could be crashing after it's opened.

Check the following stackoverflow thread about how to check the number of active connections and the max. I would expect an "ORA-00018: maximum number of sessions exceeded" error if that were the problem, so it may not be. But it's worth checking.

How to check the maximum number of allowed connections to an Oracle database?

like image 135
Brandon Avatar answered Oct 04 '22 16:10

Brandon


We've had something very similar, moved a program from 32-bit to 64bit OS & a number of concurrent processes would throw the IO Error: Connection Reset.

Stumbled across this which fixed it:

https://community.oracle.com/message/3701989

Basically add the -Djava.security.egd=file:/dev/./urandom parameter and it's good to go :)

like image 31
DotMasta Avatar answered Oct 04 '22 16:10

DotMasta


Other thing that was causing me this problem was having the HOSTNAME settings wrong. My connection attempt was hanged at:

"main" prio=10 tid=0x00007f7cc8009000 nid=0x2f3a runnable [0x00007f7cce69e000]
   java.lang.Thread.State: RUNNABLE
        at java.net.Inet4AddressImpl.getLocalHostName(Native Method)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1444)
        at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:176)
        at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:162)
        at java.security.AccessController.doPrivileged(Native Method)

So make sure you have an entry for your hostname in /etc/hosts/.

If you issue a hostname command like this:

$ hostname
my.server.com

You need a line in your /etc/hosts:

127.0.0.1 my my.server.com
like image 44
Pablo Santa Cruz Avatar answered Oct 04 '22 15:10

Pablo Santa Cruz