https://stackoverflow.com/questions/6110395/sqlrecoverableexception-i-o-exception-connection-reset

The error occurs on some RedHat distributions. The only thing you need to do is to run your application with parameter java.security.egd=file:///dev/urandom:

java -Djava.security.egd=file:///dev/urandom [your command]

11

I want to produce a complementary answer of nacho-soriano's solution ...

I recently search to solve a problem where a Java written application (a Talend ELT job in fact) want to connect to an Oracle database (11g and over) then randomly fail. OS is both RedHat Enterprise and CentOS. Job run very quily in time (no more than half a minute) and occur very often (approximately one run each 5 minutes).

Some times, during night-time as work-time, during database intensive-work usage as lazy work usage, in just a word randomly, connection fail with this message:

Exception in component tOracleConnection_1
java.sql.SQLRecoverableException: Io exception: Connection reset
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:101)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:458)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:465)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
and StackTrace follow ...

Problem explanation:

As detailed here

Oracle connection needs some random numbers to assume a good level of security. Linux random number generator produce some numbers bases keyboard and mouse activity (among others) and place them in a stack. You will grant me, on a server, there is not a big amount of such activity. So it can occur that softwares use more random number than generator can produce.

When the pool is empty, reads from /dev/random will block until additional environmental noise is gathered. And Oracle connection fall in timeout (60 seconds by default).

Solution 1 - Specific for one app solution

The solution is to give add two parameters given to the JVM while starting:

-Djava.security.egd=file:/dev/./urandom
-Dsecurerandom.source=file:/dev/./urandom

Note: the '/./' is important, do not drop it !

So the launch command line could be:

java -Djava.security.egd=file:/dev/./urandom -Dsecurerandom.source=file:/dev/./urandom -cp <classpath directives> appMainClass <app options and parameters>

One drawback of this solution is that numbers generated are a little less secure as randomness is impacted. If you don't work in a military or secret related industry this solution can be your.

https://blog.csdn.net/jackie_xiaonan/article/details/37740359

从Oracle官网论坛里找到一个帖子,讨论的问题和我遇到的问题类似,但提出的问题原因和解决方法比较有意思。按照帖子里的说法,问题的根因和Java的安全随机数生成器的实现原理相关

随机数生成器

如果不是为了解决问题,平时也不会去刻意查阅底层实现相关的原理,这次是个好机会。网上关于/dev/random的介绍很多,只列出要点:

1) /dev/random是Linux内核提供的安全随机数生成设备;

2) /dev/random依赖系统中断信息来生成随机数,因而设备数目比较少时,产生随机数的速度比较慢,当应用对随机数的需求比较大时会供不应求;

3) /dev/random在读取时会阻塞调用线程;

4) /dev/urandom是/dev/random的改良版本,解决了随机数生成慢、阻塞调用的问题,但同时稍微降低了安全性;

5) Linux环境下man random命令可以查阅到/dev/random和/dev/urandom的介绍,比较详尽;

SQLRecoverableException: I/O Exception: Connection reset的更多相关文章

  1. JDBC Connection Reset问题分析

    2014年7月13日 半年前開始.项目组測试MM在验证功能时.常常报怨讲測试环境上的应用在启动时非常慢,偶尔会报失败,遇到类似问题多数情况下又一次启动一次就能够启动成功,但少数时候也有重复启动不成功的 ...

  2. Connection reset问题,INFO: I/O exception (java.net.SocketException) caught when processing reques

    困扰我多年的Connection reset问题 第一次出现:是thrift的python client去请求server,发现偶尔出现这个问题 第二次:接入第三方的api,去请求数据时,发现一个接入 ...

  3. ”Connection reset by peer“引发的思考

    闲来无事,把之前写的一个游戏服务器框架(<一个java页游服务器框架>),部署到阿里云服务器上,测试运行了下,结果看到后台log中打印出了“Connection reset by peer ...

  4. 困扰我多年的Connection reset问题

    第一次出现:是thrift的python client去请求server,发现偶尔出现这个问题 第二次:接入第三方的api,去请求数据时,发现一个接入方的api第一次总是报这个错,当时又没有做处理,导 ...

  5. Java socket 说明 以及web 出现java.net.SocketException:(Connection reset或者Connectreset by peer:Socket write error)的解释

    另外http://www.cnblogs.com/fengmk2/archive/2007/01/15/using-Socket.html可供参考   一Java socket 说明 所谓socket ...

  6. java.net.SocketException: Connection reset 解决方法

    java.net.SocketException: Connection reset 解决方法 最近纠结致死的一个java报错java.net.SocketException: Connection ...

  7. 最近纠结致死的一个java报错java.net.SocketException: Connection reset 终于得到解决

    自从SEOTcs系统11月份24日更新了一下SEO得分算法以来,一直困扰我的一个问题出现了,java的数据job任务,在执行过程中会经常报以下的错误: “2011-12-03 18:00:32 Def ...

  8. SSLv3协议、TLSv1.2协议配置不对导致javax.ws.rs.ProcessingException: java.net.SocketException: Connection reset

    SSl:Secure Sockets Layer 安全套接层 TLS:Transport Layer Security传输层安全 是为网络通信提供安全及数据完整性的一种安全协议.TLS与SSL在传输层 ...

  9. 一次SocketException:Connection reset 异常排查

    问题描述 上一期的需求上线之后,线上多了一个异常:Connection reset.如下: [2017-03-22 00:45:00 ERROR] [creativeAuditTaskSchedule ...

随机推荐

  1. Sass函数:unit()函数

    unit() 函数主要是用来获取一个值所使用的单位,碰到复杂的计算时,其能根据运算得到一个“多单位组合”的值,不过只充许乘.除运算: >> unit(100) "" & ...

  2. mysql官网下载安装

    1.官网下载zip压缩文件 2.解压到指定文件夹 3.配置环境变量 4.新建my.ini 5.管理员权限打开cmd命令行,mysqld install mysql,mysql --initialize ...

  3. 学会如何使用shiro

    摘:https://www.cnblogs.com/learnhow/p/5694876.html 一.架构 要学习如何使用Shiro必须先从它的架构谈起,作为一款安全框架Shiro的设计相当精妙.S ...

  4. tarzan-linux命令

    1.grep -n 'b' c    查看c中包含‘b’的 行 2. ps -ef  |  grep -n python     ps查看所有进程,并且放到管道中| ,grep 在管道中查找包含pyt ...

  5. 进程管理工具uptime,top,htop

    进程管理工具uptime,top,htop 一uptime 显示当前时间,系统已启动的时间.当前上线人数,系统平均负载(1.5.10分钟的平均负载,一般不会超过1) 系统平均负载:指在特定时间间隔内运 ...

  6. 4412 使用小度wifi

    本文转载至:https://blog.csdn.net/robertsong2004/article/details/42985223 作者:刘老师,华清远见嵌入式学院讲师. FS_4412可以同链接 ...

  7. 网络体系应用层之万维网、http协议

    1.万维网概述 万维网以客户--服务器方式工作,万维网客户程序就是各式各样的浏览器,万维网文档所驻留的主机则运行服务器程序, 因此这个主机也称为万维网服务器.客户程序向服务器程序发出请求,服务器程序向 ...

  8. keil c51 不能使用:Go to Definition of....的解决方法 STC51

    keil c51 不能使用:Go to Definition of....的解决方法 达到的目标如下图所示: 解决方法为 :在工程栏右键单击进入Manage Components ,然后点确定,前提是 ...

  9. CodeForces - 1051D (线性DP)

    题目:https://codeforces.com/problemset/problem/1051/D 题意:一个2行n列的矩形,上面有黑白块,然后问你怎么布置才能有k个连通块,问有多少种方案数 思路 ...

  10. soj#532 set p3175

    传送门 分析 代码 #include<bits/stdc++.h> using namespace std; ; <<],Ans; int n,m,N; inline int ...