Drupal Error cause crashed table

Avatar
  • Answered
Hi, during last 4 weeks
for 2 times my drupal website show an error into "semaphore" table...
I solved simply lounching the table repair function in PhpMyAdmin... But I'd like to know the reason of this problem... to solve it... I try to search this error message, but I didn't found anything interesting...
Could anyone help me or suggest something please?

Thanks!
Marcello
=================================================================================
Error

The website encountered an unexpected error. Please try again later.
Error message
PDOException: SQLSTATE[HY000]: General error: 145 Table './tper_tper/semaphore' is marked as crashed and should be repaired: SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => variable_init ) in lock_may_be_available() (line 167 of/home/tper/public_html/includes/lock.inc).
Uncaught exception thrown in shutdown function.
PDOException: SQLSTATE[HY000]: General error: 145 Table './tper_tper/semaphore' is marked as crashed and should be repaired: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 53901627553a01652d5e581.16679255 ) in lock_release_all() (line 269 of /home/tper/public_html/includes/lock.inc).

==================================================================================
Avatar
JacobIMH
Hello Marcello, and thanks for your question. Was there anything that you've been doing in Drupal lately or MySQL before this table started to crash on you? Being that your site is on a VPS, anything related to your MySQL tables is going to be logged in your MySQL error log found at: /var/lib/mysql/vpsXXXXX.inmotionhosting.com.err It looks like the InnoDB database was not shut down properly before your tables started crashing on 6/1 and 6/17:
140601  8:09:39  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
...
140601  8:09:42 [ERROR] /usr/sbin/mysqld: Incorrect key file for table './tper_tper/semaphore.MYI'; try to repair it
140601  8:09:42 [ERROR] Got an error from thread_id=12, /home/rpmbuild/rpm-build/BUILD/mysql-5.5.36/mysql-5.5.36/storage/myisam/mi_write.c:226
140601  8:09:42 [ERROR] MySQL thread id 12, OS thread handle 0x7f5c788ba700, query id 1961 localhost tper_d7tper update
INSERT INTO semaphore (name, value, expire) VALUES ('cron', '219215740538b1806d1da94.90282662', '1401624822.86')
...
140601  8:31:38 [ERROR] /usr/sbin/mysqld: Table './tper_tper/semaphore' is marked as crashed and should be repaired
140617  2:51:05  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
...
140617  5:48:47 [ERROR] /usr/sbin/mysqld: Incorrect key file for table './tper_tper/semaphore.MYI'; try to repair it
140617  5:48:47 [ERROR] Got an error from thread_id=61477, /home/rpmbuild/rpm-build/BUILD/mysql-5.5.36/mysql-5.5.36/storage/myisam/mi_delete.c:121
140617  5:48:47 [ERROR] MySQL thread id 61477, OS thread handle 0x7f6a5bd2a700, query id 4191106 localhost tper_d7tper updating
DELETE FROM semaphore
WHERE  (name = 'cron') AND (value = '392161749539fe4cc14e7f5.68802805') AND (expire <= '1402987964.27')
140617  6:12:43 [ERROR] /usr/sbin/mysqld: Table './tper_tper/semaphore' is marked as crashed and should be repaired
This can sometimes happen if the MySQL service is abruptly stopped without properly shutting down. Unfortunately I don't see anything in the MySQL logs giving an exact reason why it's crashing at times. Have you noticed any other problems other than just crashed tables with your MySQL databases? - Jacob