Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are running MySQL 5.1.33 on FreeBSD 7.2-RELEASE.

This is a development database server attached to a development webserver running Silverstripe and PHP 5.3.

This morning, the development webserver was complaining that it could not connect to the database server. The PHP error was the "Can't connect to MySQL server on 'host.example.gov'".

We discovered that there are thousands of open files on the Database server, which is also unusual considering this server is mostly idle.

# lsof |grep /var/db/mysql/DATABASE  |wc -l
5135

There are also thousands of connections in TIME_WAIT status, which is unusual. I am expecting these TIME_WAIT connections to time out, but they haven't ended in the last 20 minutes.

# netstat -an | grep 3306 | grep -c TIME_WAIT 
2650

There don't seem to much activity happening on the database server:

# mysql -e "show full processlist;"
+------+------+-----------+------+---------+------+-------+-----------------------+
| Id   | User | Host      | db   | Command | Time | State | Info                  |
+------+------+-----------+------+---------+------+-------+-----------------------+
| 2489 | root | localhost | NULL | Query   |    0 | NULL  | show full processlist | 
+------+------+-----------+------+---------+------+-------+-----------------------+

My question: From within MySQL, how can I tell what is holding on to these files? Maybe the open files are a red herring.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

It turns out that this problem was caused by a faulty localhost firewall. mysql clients were able to connect initially (or make some connections), but subsequent packets were being ignored.

I'm still trying to figure out about the open-files, but that problem has gone away.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.