Connection Leak
커넥션 리크는 예외 경로에서 반환이 끊길 때 생긴다
풀 고갈의 원인은 리크만이 아니지만, 코드가 연결을 반드시 닫는지는 가장 먼저 확인한다.
Connection c = dataSource.getConnection();
PreparedStatement p = c.prepareStatement(sql);
p.executeQuery();
c.close(); // 예외 발생 시 실행되지 않음
try (Connection c = dataSource.getConnection()) { ... }
관찰나쁜 경로executeQuery 이전 예외와 이후 예외 모두 close를 건너뛸 수 있다.
관찰좋은 경로try-with-resources가 ResultSet, Statement, Connection을 역순으로 닫는다.
관찰운영 신호Active가 계속 증가하고 Idle이 사라지며 timeout이 늘어난다.
관찰추적leakDetectionThreshold는 의심 구간을 찾는 임시 도구로 쓴다.