Friday, March 15, 2019

An interesting issue about "SQLRecoverableException: I/O Exception: Connection reset"

I developed a Java application (Spring boot) to pump the data from Oracle database to Mongo DB, to improve the performance, I use 8 processes to pump at the same time.
It works perfect on my local (Windows 10), it only takes 2.5 mins to pump 1 million records from remote Oracle to my local mongo. However, when I tried to run the application from the Linux box, it becomes very slow and after several minutes, I can see the exception "SQLRecoverableException: I/O Exception: Connection reset".

Oracle JDBC driver/JDK1.8 has a bug to generate the random number on some Linux (say Redhat), if the below command cannot return immediately then the issue will happen:
                 head -n 1 /dev/random
The fix is to set the property or
  1. Open the $JAVA_HOME/jre/lib/security/java.security file in a text editor.
  2. Change the line:
  3. securerandom.source=file:/dev/random
    to read:
    securerandom.source=file:/dev/urandom


http://www.usn-it.de/index.php/2009/02/20/oracle-11g-jdbc-driver-hangs-blocked-by-devrandom-entropy-pool-empty/
https://docs.oracle.com/cd/E13209_01/wlcp/wlss30/configwlss/jvmrand.html
https://stackoverflow.com/questions/6110395/sqlrecoverableexception-i-o-exception-connection-reset
https://community.oracle.com/thread/943911


No comments:

Post a Comment