Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 38,597,187 milliseconds ago. The last packet sent successfully to the server was 38,597,188 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
Caused by: java.net.SocketException: Connection timed out (Write failed)
개발서버에서 작업 후 다음날 출근하여 동일한 웹페이지에서 쿼리를 보낼 때 발생하는 오류이다. 매일 아침 반복되고 있다.ㅋㅋ mysql connection 이 끊어진 것으로 보이는데... mysql 의 wait_timeout 옵션에 8시간으로 설정되어 있어, 이 시간이 지나고 쿼리를 보낼 때 발생하는 오류이다. autoReconnect=true 를 설정하라는 메시지가 보이지만 이미 설정된 상태이며, 같은 상황에서 이 옵션은 어쨌든 재접속에는 성공하겠지만 접속이 끊긴 상태에서의 첫번째 요청에는 에러를 발생시킬 것이다.
Caused by: java.sql.SQLException: Could not retrieve transation read-only status server
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 32,648,084 milliseconds ago. The last packet sent successfully to the server was 20 milliseconds ago.
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
마찬가지 상황인데 이를 방지하기 위해서는 dbcp 설정을 추가/수정해야 한다.
- validationQuery : select 1 - testWhileIdle : true (커넥션 풀 안에 있는 유휴 상태의 커넥션을 대상으로 테스트 실행) - timeBetweenEvictionRunsMillis : 7200000 (쓰레드가 동작하는 간격) - testOnBorrow : true (커넥션 풀에서 커넥션을 가져올때 해당 커넥션의 유효성 검사 실행) |
위는 2시간 마다 유휴 상태의 커넥션을 대상으로 'select 1' 쿼리를 실행하여 커넥션을 유지시키는 설정이며, naver d2 사이트에서 성능상 testOnBorrow 옵션과 testOnReturn 옵션은 false, testWhileIdle 옵션은 true 로 설정을 추천하고 있지만, 개발서버에는 testOnBorrow 를 true 로 설정하는 것이 좋을듯...?
WRITTEN BY
- 손가락귀신
정신 못차리면, 벌 받는다.
,