1

For some reason,the connections to my local database are put to sleep, even though the database is not actually doing anything:

mysql> SHOW FULL PROCESSLIST;
+-----+------+-----------+-----+---------+------+-------+-----------------------+
| Id  | User | Host      | db  | Command | Time | State | Info                  |
+-----+------+-----------+-----+---------+------+-------+-----------------------+
|  85 | root | localhost | *** | Sleep   |  810 |       | NULL                  |
|  88 | root | localhost | *** | Sleep   |  662 |       | NULL                  |
|  89 | root | localhost | *** | Sleep   |  586 |       | NULL                  |
|  93 | root | localhost | *** | Sleep   |  692 |       | NULL                  |
|  98 | root | localhost | *** | Sleep   |  719 |       | NULL                  |
| 102 | root | localhost | *** | Sleep   |  545 |       | NULL                  |
| 182 | root | localhost | *** | Query   |    0 | init  | SHOW FULL PROCESSLIST |
| 263 | root | localhost | *** | Sleep   |  809 |       | NULL                  |
| 275 | root | localhost | *** | Sleep   |  660 |       | NULL                  |
| 279 | root | localhost | *** | Sleep   |  584 |       | NULL                  |
| 282 | root | localhost | *** | Sleep   |    1 |       | NULL                  |
| 283 | root | localhost | *** | Sleep   |  544 |       | NULL                  |
+-----+------+-----------+-----+---------+------+-------+-----------------------+
12 rows in set (0.00 sec)

No new connections are being made and there's no lock, but somehow the requests are not being processed. Any idea what could be causing this?

laurent
  • 88,262
  • 77
  • 290
  • 428

2 Answers2

1

In this context Sleep simply means that the thread is idle. Here's the definition from the manual:

  • Sleep

The thread is waiting for the client to send a new statement to it.

Ike Walker
  • 64,401
  • 14
  • 110
  • 109
0

By default PHP is configured to allow persistent MySQL connections. That's why you're seeing all these sleeping connections, just waiting to be re-used.

Whether you want to use persistent links or not is a different question, but if you want to disable it then you need to make a change to your PHP.ini

mysql.allow_persistent = Off
Vincent
  • 1,741
  • 23
  • 35