Drupal 7 Cron Failed How? To Remove A Database cron_semaphore

Mon, 11/14/2011 - 19:49
Comments

If you getting errors like the one below then you will likely need to find the source of the issue and then use the SQL queries to remove it.

Cron Failed Attempting to re-run cron while it is already running.

A Cron can fail for any number of reasons, I won't go into great detail of all the issues that stop a Cron running but as a start try looking for Php code in the body area. Php code should be added into a .module file if you are doing anything complex, as a rule, try not to add php into content areas.
If you have PHP code in the body area try to look for the PHP exit; or die functions. These will end a Cron before its finished and will not remove the Cron_semaphore link in the database.
Any number of modules can stop a Cron from running and solutions to the issues will be on the related modules issues pages, To troubleshoot these type of errors you should try and check your sites status report first. How long ago was it since the last time the Cron ran? if it's not run for a long time you can get content display issues on your site.
If your XML Sitemap modules chunk size is higher than 10,000 it can struggle also set search settings to 

"10 per Cron" and rebuild your search index.


I have also heard of some hosting sites disabling the running of Cron. As a last option try contacting your host to see if they do this as standard.
If you are still not having a luck try to run Cron manually from your browser? yoursitename.com/cron.php
Check what errors are you getting on the recent log entries? A quick Google search on this error will take you to the source of the issue if its related to a module someone else will have likely found this before you have if not make a post giving as much information as possible to the developers.
To troubleshoot this in more depth try looking into Devel & Drush. Devel can also remove a semaphore if you are unsure of using SQL.
I am sure you are here to find a quick solution into removing the cron_semaphore in PhpMyAdmin so to do this log into your control panel click on the SQL tab and you will see a handy box which says:
Run SQL query/queries on the database
Add the SQL below and select go

DELETE FROM `variable` WHERE name = 'cron_semaphore'; DELETE FROM `variable` WHERE name = 'cron_last';

You should now get a confirmation message that it has been removed. Run you Cron and then your cache and it should now work. The small print: I don't take any responsibility for any of the help I have provided above, code changes can happen and make these redundant. However, if you think you have something to add or should be changed please let me know.
If you have PHP code in the body area try to look for the PHP exit, or die functions. These will end a Cron before its finished and will not remove the Cron_semaphore link in the database.
Any number of modules can stop a Cron from running and solutions to the issues will be on the related modules issues pages, To troubleshoot these type of errors you should try and check the status of your site report first. How long ago was it since the last time the Cron ran? if it's not run for a long time you can get content display issues on your site.


If your XML Sitemap modules chunk size is higher than 10,000 it can struggle also set search settings to 
 

We are Digital Source

We are Digital Source

Come to the source of your online presence

our portfolio

Recent Posts