Lock wait timeout fix

From Wikitech
Jump to navigation Jump to search

Servmon's Querybane component now automatically kills sleeping threads once they get old, so this problem is unlikely to be encountered frequently.

If there are complaints about lock wait timeout errors and/or being unable to save a page for many hours, do this:

  • connect to the database server and use show processlist. Look for queries which are in status sleep and have a long run time (thousands of seconds). Use the kill threadid command to end those processes.
  • The default time for MySQL to wait for a web server is 8 hours (28800 seconds). You can interactively change this to 15 minutes with set global wait_timeout=900 (requires root) and update /etc/my.cnf with set-variable = wait_timeout=900. Shared hosting places may prefer a shorter time, in the one to five minute range.

This is believed to be caused by PHP getting into an infinite loop or otherwise hanging with a connection open.