tags:

views:

245

answers:

1

The output of netstat -an shows many mysql connections in CLOSE_WAIT state and when i checked the processlist in mysql using 'SHOW PROCESSLIST' the connections shown in netstat do not appear. What possible could be the reason for this. I use tomcat with mysql-connector and use a Connection Pool as well.

Is it that the application is not closing the mysql connection or is there any other reason for this behaviour... sometimes the CLOSE_WAIT reaches over 200.

On the application level i made sure that i close all the connections(make sure i issue a close() command in the finally block) created using jdbc.

Any help would be appreciated.

A: 

If the netstat is done on the application machine, it could mean misconfigured MySQL servers.

Please check following global variables in MySQL server,

  interactive_timeout
  wait_timeout

If any of these are too short, it will cause this problem. We normally set both to 1 hour when pooling is used.

The TCP is stuck in CLOSE_WAIT state when server closes connection but the connection pool hasn't got a chance to close the connection.

ZZ Coder
Interactive timeout value is 28800 and wait_timeout value is 1200.. i guess they are not short, any other reason why this happens??
Sudheer