BacGyber's Tricks

[solved] Oracle 접속 WAS 로그에서 SQLRecoverableException 발생

□ Tech (Software)

최근 오픈한 시스템에서 겪은 내용 간단히 정리합니다.


일부 사용자들이 웹페이지가 안열린다는 얘기가 있었습니다.


WAS 로그를 확인해봤는데 

두대중 한대의 WAS 로그에서 이러한 내용이 있었습니다. 



java.sql.SQLRecoverableException: I/O Exception: Connection reset



구글링했더니 도움이 될만한 검색결과가 여러개 나왔던거 같습니다.

그 중 오라클 커뮤니티 게시물 내용이 깔끔한거 같아 복사해둡니다.


I was recently struggling with this exact same problem. I opened a ticket with Oracle and this is what they told me.


java.security.SecureRandom is a standard API provided by sun. Among various methods offered by this class void

nextBytes(byte[])

is one. This method is used for generating random bytes. Oracle 11g JDBC drivers use this API to generate random number during

login. Users using Linux have been encountering SQLException("Io exception: Connection

reset").


The problem is two fold


1. The JVM tries to list all the files in the /tmp (or alternate tmp directory set by -Djava.io.tmpdir) when

SecureRandom.nextBytes(byte[]) is invoked. If the number of files is large the

method takes a long time to respond and hence cause the server to timeout


2. The method void nextBytes(byte[]) uses /dev/random on Linux and on some machines which lack the random

number generating hardware the operation slows down to the extent of bringing the whole login process to

a halt. Ultimately the the user encounters SQLException("Io exception: Connection reset")


Users upgrading to 11g can encounter this issue if the underlying OS is Linux which is running on a faulty hardware.


Cause

The cause of this has not yet been determined exactly. It could either be a problem in

your hardware or the fact

that for some reason the software cannot read from dev/random



Solution 

Change the setup for your application, so you add the next parameter to the java command:


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




We made this change in our java.security file and it has gotten rid of the error.





* 내용을 보면... Linux 상에서 파라미터를 조정하여도 해결될 확률은 있는거 같군요.

  어떤 이유인건 간에... Linux 상의 부하로 인해 발생할 수 있는 상황 같기도 하구요.

  적용한 이유 문제가 없는걸 보면... 이번 경우는 위의 두가지 유형중 두번째에 해당하는 확률이 높은것 같습니다.  



* 환경 정보 요약

Linux Server상의 JEUS 에서 Oracle 12C 에 연결