I have a system using apache commons package dbcp for database connection pooling. We're using MySQL 5.0 (mysql-connector-java-5.1.6).
Just found that the system after running a couple of hours got an exception in the log files when trying to create a new database connection:
java.net.SocketException: Too many open files
Checked the list of open files (lsof) and got a long list:
java 10659 admin 6u sock 0,4 1555102 can't identify protocol
The PID is the jvm running our system.
Found that the MySQL setting wait_timeout (that closes idle connections after the configured time) was set to 60 seconds by accident. So it seems that when MySQL closes an idle connection somehow the
JDBC connection in the database pool isn't closed properly leaving the file descriptor open (this is a
test system so there are many idle connections).
Have anyone have encountered anything similar or have any suggestions on how to proceed?