Cron failed to run, and i have no idea why. My site depends on cron working. I am not that technical. Any ideas? please help.

Comments

VM’s picture

will it run manually ? yoursite.com/cron.php ?

blavish’s picture

Even when i am logged in. and i run it, doesnt work.

Any help will be great. Thanks.

2dareis2do’s picture

I had a similar problem. Not sure if it is related to some module I have installed but looking at the drupal log I noticed the following errors:

	Type	Datesort icon	Message	User	Operations
warning	page not found	02/10/2011 - 17:51	sites/all/themes/entropay_c/css/misc/watchdog-ok.png	admin	
warning	page not found	02/10/2011 - 17:51	sites/all/themes/entropay_c/css/misc/watchdog-error.png	admin	
warning	page not found	02/10/2011 - 17:51	sites/all/themes/entropay_c/css/misc/watchdog-warnin ...	admin	

I was able to relink these files from my css and after cron seemed to run ok.

Also had to insert the following in my php.ini file

apc.rfc1867 = 1

coreykck’s picture

I've multi site installation on a personal server; I've 3 sites in the same root, 2 of those run without any problem.
One with problem on cron, is a multilanguage site; when i run cron, the page opened is this it/%252Fuser, if i disinstall Search module, cron runs fine.
any ideas?
Bye corey

NancyDru’s picture

If you have any PHP nodes, that can cause serious problems with search indexing.

coreykck’s picture

Hi Nancy,
you've hit the problem, I've a page with this php code:

drupal_goto('/user');

slash removed, cron ran!
TNX

NancyDru’s picture

This is part of the reason why standard line in Drupal is "No PHP code" in content. Create a site-specific module for your code.

julianmancera’s picture

Hi Nancy,

What do you mean with php nodes?

Julian

NancyDru’s picture

Nodes that use the "PHP Code" input format.

yuvraj_jain’s picture

will you please explain me that the php nodes will create which types of issues.

puddyglum’s picture

This was exactly what our problem was. Forgot the warning about using drupal_goto within nodes.

mikey_p’s picture

When you load cron.php is there an error reported? or are you seeing an error in the logs at admin/logs/watchdog ?

When you load cron.php in a browser the standard result is a blank page.

-Mkey P

blavish’s picture

Cron has been running for more than an hour and is most likely stuck.

And when i run /cron.php there is a blank page.
Do you know how to fix this?

Thank you for the help

VM’s picture

running cron manually will produce a blank page. theres no output. after you run it manually, does your status log says its complete ?

blavish’s picture

Attempting to re-run cron while it is already running

Any ideas what i can do?

Thanks

VM’s picture

remove your cron job from your host. try to run cron manually. if that doesnt work your host may need to be informed.

blavish’s picture

'remove your cron job from your host. try to run cron manually.'

Thank you again for the help.

jasio’s picture

Hi,

As someone pointed out, cron.php does produce an empty page.

1. What does your status page (http://your.site/?q=admin/logs/status) say about cron? Mine, for example, says:

Cron maintenance tasks Last run 4 min 24 sec ago
   You can run cron manually.

2. Run cron manually - you can open http://your.site/crone.php from your browser, or better click a link in the status report. Did the status report change? Mine did:

Cron maintenance tasks Last run 4 sec ago
   You can run cron manually.

3. If you complain that your cron does not work any more, I suppose, that it did - so you must have had to configure it somehow. You can execute cron.php directly (well... almost... you need a console web browser or wget) from a machine the system is on, remotely from another machine you have a shell access (in case of unix/linux, or a similar level of access in case of Windows), one of cron services in the Internet (for example, I use a cron service provided by my ISP), or a poormanscron module - depending on your access rights, available services etc. You have not written, which way you execute your cron.php, so it's rather difficult to advise, how to turn it off and diagnose. In general, turning cron off is quite similar, to turning it on. :)

4. You were not specific. How do you recognised that cron had not worked? Was it something in a status report or drupal admin page, or you noticed, that some of tasks cron was supposed to do had not been done?

--
Best regards,

(js).

VM’s picture

Your hosts documentation should provide for you the information specific to their/your server on setting up cron jobs on the server. you would point the cronjob to yoursite.com/cron.php and it would run automatically without using yet another module like poormans cron.

blavish’s picture

What i did was i ran cron from the hosting company in cpanel
that saw that it crashed and reset it. so i installed poormanscron and made it to run every 10 minutes.
That fixed it.

Thanks for all the help.

NancyDru’s picture

You need to delete the variable 'cron_semaphore' from your variables table. You can do this with phpMyAdmin, the Devel module, or the Site Documentation module.

Cron will not run again until this is done or the long running job completes (which is unlikely after an hour).

If you have Update_Status on this site, I suggest you disable it - this is the primary culprit I have seen for stalled Cron jobs. IMHO it should not be used on a production site any way.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

asbdpl’s picture

> If you have Update_Status on this site, I suggest you disable it - this is the primary culprit I have seen for stalled Cron jobs.

There are lots of other modules causing Cron to hang, e.g. "Amazonitems" which tries to update it's data through Amazon's REST API. You can configure Cron to send reports about deadlocks and errors. If you do, you'll get messages like:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4104 bytes) in /var/www/drupal/modules/amazontools/amazon.module on line 506

Another potential candidate is "db_maintenance" which compacts database tables on a regular basis; this module is smart enough to let the user choose, how often (daily/weeky/monthly) and which tables have to be "optimized". If you have a mid-sized Drupal site and set it to "daily" optimize the complete database, it is very probable that Cron will fail.

Another module might be "Search" from Druapl Core, where at least the number of nodes to be indexed can be configured (10-500). Depending on the hardware, especially on slow machines with limited amount of RAM, I found it necessary to set this as low as possible (10 nodes/Cron run). Also, it might be advisable to look for alternatives like SQL Search/Trip Search or even to utilize Google search.

Lots of modules rely on Cron, few of them can be throttled in a reasonable way - "Indexing status: 0% of the site indexed. 20788 nodes to go"...

Regards, -asb

Oceria’s picture

(...)You can configure Cron to send reports about deadlocks and errors.(...)

After setting search indexing to 10 a time, settings pathauto to 25 (default 50, but I had it set to 100 to manually bulk update and then forgot to put it back to 50) and setting xml.site (aka gsitemap) chunksize to 10,000 rather than 50,000, my cronjob does not fail anymore, even with the update status running. Mind you: it is set to check once a week, so it cannot hogg every cronjob...

However, I am curious about the cronjob configuration. I have searched drupal.org for "configure+cron.php+report+error", but did not find a way to configure cronjobs in a way you describe. Could you tell us where to find that info, or how it is done?

Oceria doesn't know where this -repeatbutton -repeatbutton is....

executex’s picture

Thanks a lot you solved my problem.

1) After deleting semaphore in Variable table....
2) Set XML Sitemap module chunk size to 10,000.
3) Set Search Settings to "10 per cron"
4) Set PathAuto General settings from 50 to 25 for objects to alias.
5) Ran Cron, it stopped failing...
This has been bugging me for months. Thanks.
-
Computer Engineer from Virginia Tech

adminfor@inforo.com.ar’s picture

After deleting cron_semaphore, still no running. Also rebooting the server and no solution.
I also changed cron_last as node_cron_last +1 and cron.php released OK
Cheers!
Gustavo

openam’s picture

I tried deleting cron_semaphore, and cron.php still would not run. It did however work once I dissabled the Update Status module.

Thanks for the tip.

HS’s picture

Cron refuses to run in my case. I disabled the update status module as well and tried, but nothing.

My DB doesn't have a variable called 'cron_semaphore' in my variables table.

Any ideas folks? It's been several days. I check my site's status and see Cron hasn't run for several days.

I have it configured on DreamHost's Cpanel to run every hour. Although the Cron job fires from cpanel it doesn't run.

NancyDru’s picture

Set the cPanel email address to have it email the results to you so you can see if there are any errors coming out. I recently took over a web site where the command to fire cron was wrong.

HS’s picture

I fixed my issue.

Command to run Cron on DreamHost as per the Drupal installation guide was incorrect or needed more clarification.

This
curl --silent --compressed http://example.com/cron.php

needed to be changed to this:
curl --silent --compressed http://www.example.com/cron.php

I just added the www. prefix to the cron command and it works like a charm now.

I did have the Cpanel report to me via email that cron wasn't running.

NancyDru’s picture

Thatis probably dependent on how you have .htaccess set up - whether to access the site with or without "www." I set all my sites to not use "www."

Napzilla’s picture

Deleting the row containing "cron_semaphore" fixed the problem for me, too! Thank you much! For peeps who are comfortable with it, the easiest way to get rid of the offending row may be to use the following MySQL query:

DELETE FROM variable WHERE name="cron_semaphore";
NancyDru’s picture

Drupal 6.16 included a change to potentially prevent all these problems.

Majdi’s picture

I dont know if this solution will fix my problem , Some times the cron job get stuck, after I did what you says the site start running very fast , but i need more time to check that problem will not back again
thanks

executex’s picture

My error seems to only say "Cron failed to run" after clicking "run cron manually".
Also the first time I did this it said "Server internal error 500" or maybe it was 503.
In the watchdog logs it says "tried to run cron while Cron is already running"
It doesn't make any sense to me, my last cron is still 24 weeks ago, and I did try using cron.php... I don't know what happened (I use 1and1.com hosting).
I tried poormanscron but it seems to give an internal error 503 or 500 when confirming installation.

I don't understand how cron works, and there doesn't seem to be any options to play with in settings.
-
Computer Engineer from Virginia Tech

NancyDru’s picture

Can you go to your status report and run it manually? 24 weeks is an awful long time between runs.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

executex’s picture

That's where the Run Cron Manually click is at... I tried that, it refuses to run. Seems to happen in many of my Drupal installations. I simply assumed Cron was just never tested enough to work on any site. Perhaps because of the server i use.
-
Computer Engineer from Virginia Tech

NancyDru’s picture

What errors are you getting? Cron runs fine on tens of thousands of Drupal sites.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

executex’s picture

Running Cron manually for first time: "Server internal error 500"
After Running Cron and going to Status Report: "Cron failed to run"
Watchdog: "tried to run cron while Cron is already running"

Apparently it doesn't work on 1and1 servers... Or magically my sites.
MySQL database 4.0.27
PHP 4.4.7
Web server Apache/1.3.33 (Unix)
-
Computer Engineer from Virginia Tech

NancyDru’s picture

Start by removing the variables mentioned above. When you manually invoke the Drupal Cron function, there is nothing that should not work.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

executex’s picture

I have one site, its a plain old drupal site, with just a lot of modules similar to my other site, that doesn't have much of anything, and that is working fine. It crons normally. Nothing fails. It's the other site with clean urls and htaccess edit that seems to fail everytime and get internal server errors when running cron.
Logs say:
Message Cron has been running for more than an hour and is most likely stuck.
Severity error

This I suppose has been like this for 24 weeks according to status report.
-
Computer Engineer from Virginia Tech

NancyDru’s picture

And it will stay that way until you delete "cron-semaphore." Until you do that, Cron will not run again. Until you do that, there is no point in posting any more error messages. This may have been left set for any number of reasons and it is probably too late to know now.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

executex’s picture

I dont know what you're talking about:
This is my variable table that has the word "cron" in it:

node_cron_views_scale d:0.0018975332068311194788634566066320985555648803...
Edit Delete cron_last i:1185924138;
Edit Delete node_cron_last s:10:"1177429673";
Edit Delete node_cron_last_nid s:1:"3";
Edit Delete xmlsitemap_cron_submit i:0;
Edit Delete search_cron_limit s:3:"100";
Edit Delete privatemsg_last_cron i:1200803514;
Edit Delete node_cron_comments_scale d:0.2;
Edit Delete poormanscron_lastrun i:4200;
-
Computer Engineer from Virginia Tech

estephan500’s picture

hi all

-- deleting the semaphore variable worked for me

-- it fixed my problem where drupal was saying "Cron failed to run."

Here is how I did it:

-- downloaded and activated the module called "Devel," which simply has some handy techie administrative functions for drupal administrators.
-- went to the blocks menu and made it so that the block called "Development" appeared in the left sidebar.
-- when that block appeared, at the bottom there is a link called something like "variable editor" or something like that.
-- it shows a big table of variables. scan down (or use your browser's find command) to find the one with the word semaphore in it
-- check the box next to that one, and then at the verrrry bottom of the page, click the delete button.

thanks to the helpful woman that posted that tip!! --eric

samkat12’s picture

thank you very much with the suggestion from estephan500 . after following instructions Cron run successfully. thanks again.

thinkpadius’s picture

This advice helped. I can't tell you how much easier it makes life when someone takes the time to put down steps to solve problems.

You saved me hours of frustration. Now I can get back to being productive. Thank you!!!

BeaPower’s picture

Thanks deleting sepahmore helped!

riyajain89’s picture

You are right.

Mojah’s picture

I've been experiencing a similar issue on a production site. In order to get the search index module to run, I have to go into the variables table and delete the entries for cron_semaphore and cron_last, else I get this message...
Cron has been running for more than an hour and is most...
I also get these messages in watchdog...
Attempting to re-run cron while it is already running.
mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/heaven/domains/heavenletters.org/public_html/includes/database.mysql.inc on line 218.

I run cron from command line and it usually works after deleting the entries from the variables table. php timeout has been extended on the vps account the site runs on. I disabled modules likely to affect cron, like schedule and subscriptions (which does have a list of bugs), yet still cron seems to get stuck when I setup a cronjob. This particular site has nodes on schedule which get published at around 2am everymorning, so that people closer to the land of the rising sun can receive their content first thing in the morning.

<aside>I have a cronjob that calls a Drupal node which outputs the latest published cck node type to a text file, which is then distributed via our newsletter management software</aside>

I don't mind publishing manually at 2am, but it would be more efficient if it was aut0mated ;)

Suggestions anyone?

memtkmcc’s picture

Same here, I have Drupal powered websites on 3 different VPS servers, and all websites running similar modules but under MySQL 5.0.41 & PHP 5.2.2 & RH9 works fine, no problems with cron, however one new website using MySQL 5.0.37 & PHP 5.2.3 & CentOS has now exactly the same problem as reported: "Cron run failed" and watchdog says: "Attempting to re-run cron while it is already running."

Mojah’s picture

Interesting! I'm on Centos VPS accounts with mysql 4.1.11 and php 4.4.2. Could this really be something to do with php and Centos. I wonder if anyone else is experiencing the same.

Mojah’s picture

Bump bump, anybody ;)

The only thing that works for me now is deleting from variables table and running cron from command line. Poormans cron does the job partially but I require cron to be run at a specific time.

I noticed several mysql errors mysql_num_rows(): supplied argument is not a valid MySQL and duplicate entries errors for the search_update_totals query.

Oceria’s picture

As said a lot of modules are cron hoggers. Do you have a forum embedded other than the standard forum? That was the culprit for me.

Other tips that help:

  • Set cronjob to run ever 15 minutes, or even more often
  • Set search index to minimum (10)
  • Set xml sitemap to chunks of 1,000 (instead of 50,000)
  • Go over all other modules and set them to the lowest workload possible

Now after checking all that, run cron manually, untill in search everything is indexed, all url's have been converted to clean url's and all comments that should be closed are closed. This might mean you need to run cron quite a few times! If all is well your cronjob should not time out anymore. If it still does, set php to max_exec_time for 240 seconds and max_input_time for 240 seconds as well. Also set your php max memory to 16 or 32 MB (depending on the rules of your host) to give cron more time and memory to run. If cron still runs out of time, reduce the time between cronjobs even lower. Running cron takes up time and CPU power, so don't go lower than 10, maybe 5 minutes. If it still times out, review your modules. Which ones do you realy need? Disable the ones you dont realy need and check again.

Oceria doesn't know where this -repeatbutton -repeatbutton is....

TC44’s picture

Same problem, php 5.

Cron started failing, none of the above suggestions work, although deleting cron_semaphore did work initially, but not anymore.

delmont’s picture

I tried all of the above, and even went so far as to delete every row in the variable table that even had the word "cron" in it, but nothing helped. The only way I finally got cron to run was to delete the search index at admin/settings/search, and start over from scratch. As soon as I deleted the index, I tried to run cron manually from admin/settings/status and it worked immediately.

Sree’s picture

yes....

"delete the search index" - this was also the same thing which i followed to solve my cron rel issues ....

-- Sree --
IRC Nick: sreeveturi

blavish’s picture

And it fixed it for some reason.

creativepragmatic’s picture

After attempting all of the above, I solved this problem by reducing the 'Index Throtte' to a level my server could handle. I realized that my server doesn't have the resources to handle 100 items at one time.

Anonymous’s picture

I've noticed a lot of request for help with Cron issues and perhaps someone could offer a suggestion on a problem I'm having. I recently upgraded a Drupal 5.x site to Drupal 6.1

Everything is working fine except the Cron.php file fails with an error message that says;

"Table xxxxxxx.websites.test" not found (or words to that effect).

To my knowledge I've never had a table named "websites.test". I DO have an MYSQL db named "websites".
My problem is that I have no idea as to where to look for the error. I've search the cron.php file and other file native to the Drupal 6.1 installation to no avail.

Suggestions welcome. Where is this error coming from? How do I clear it so cron will run?

NancyDru’s picture

Cron itself is pretty dumb and does very little. There are many modules that implement hook_cron. It is one of those modules that is producing the message.

Create a php format page to see who it might be:

  echo theme('item_list', module_implements('cron'));

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

Anonymous’s picture

I traced the error down to the Search module, which is a part of the Drupal 6.1 core.
If the search module is disabled the error goes away. I suspect that the problem is with the search index, but I have no idea as to where the index is or how to clear it.

For the time being, the error is gone and I don't really need the search module - in fact it never worked properly anyway, so leaving it off resolves the issue. I would like to know where the search index is just for reference.

Anyone got any ideas?

NancyDru’s picture

Search builds several tables in the database - one of them is the index. The easiest way to clear it is to click the rebuild button.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

yngens’s picture

same problem here. i reinstalled search module, set Number of items to index per cron run in search module to 10 items, cleared sron_semaphore variable, and successfully run cron but for just ONCE. trying to manually run cron fails again.

klcthebookworm’s picture

Cron refuses to run manually. The report logs tell me every time I hit the link, it is failing because it is already running. I can't find what it has gotten hung up on.

Update Status module is off. I've deleted the cron_semaphore from the variable table three times tonight, and still I'm getting cron run failure. The search index has been set at 10 and the rebuild button pressed, so it should just need the cron to run. I tried the php format page with the code you suggested and got this:

Parse error: syntax error, unexpected '>' in public_html/includes/common.inc(1655) : eval()'d code on line 1

I don't understand; common.inc is a file straight from Drual 6.13 that I have never had to mess with. Plus I just started two Drupal 6 sites last month and their cron jobs are running perfectly. And apparantly this site was having issues with cron under Drupal 5 that I wasn't aware of until I started updating to Drupal 6.

I really need to get my site up and running now, but I can only assume I need cron running correctly so the content is uploaded properly for my users. I don't know anything about PHP coding or how to fix it.

VM’s picture

I'd start disabling modules one at a time (specifically contrib) to see if the problem is static from a module.

The parse error isn't coming from common.inc it's just failing there and dumping the trash.

NancyDru’s picture

That means you have a php formatted page or story that is trying to be indexed and it is invoking the php processor while doing so. You need to find that page and fix it.

klcthebookworm’s picture

Okay, I think I found all the broken PHP coded pages and blocks, deleted them, and replaced with Views-built pages or blocks. Actually that helped clue me into a whole broken section that I had missed, so thanks for that.

I double checked for cron-x listed in the variables table and didn't see anything to delete.

Clicked on run cron manually, and was told it failed again. Re did the page with the php code to figure out what is wrong now and get the same error message.

Parse error: syntax error, unexpected '>' in /public_html/includes/common.inc(1655) : eval()'d code on line 1

In the access logs, all they tell me is that "cron has been running for over an hour and is most likely stuck" and "cron run manually failed because cron is already running." I have set up an email on the cron job in Cpanel on the off chance that I might get something more from those error logs.

On the off chance that I missed a PHP-code node, is there any way to filter search for them?

I haven't tried turning off modules yet other than Update Status because everything I have on I need for the function of the site.

Update: I finally got a book of an error from the cron job email on the fifth job it run. It kept mentioning search.module, so I turned it off. Then once I deleted that PHP formatted page and ran update.php, cron job FINALLY ran manually!

Thanks for the help.

jannalexx’s picture

It revived cron here

temporarily modifying common.inc drupal_cron_run() to disable the semaphore entirely :

// Fetch the cron semaphore
//$semaphore = variable_get('cron_semaphore', FALSE);
$semaphore = FALSE;

run cron, and then return to old common.inc

Related:
http://davlan.blogspot.com/2009/07/drupal-cron-failed.html
http://www.digitaledgesw.com/node/21

cakka’s picture

thanks for this tips friends

i have successfully run my cron :)

dbkguy’s picture

I have the default cron files installed. I never changed them. Cron.php is configured to run twice a day and this is the error report I get in e-mail twice a day. In the status page says you can run manually, but it points to a admin/reports directory which doesn't exist.
I have run cron.php from my firebox browser and I can a white page result, but status still says it never ran.

Any ideas what's wrong. I use GoDaddy.com

Here is my e-mail error report.

/var/chroot/home/content/d/b/k/dbkguy/html/cron.php: line 1: ?php: No such file or directory
/var/chroot/home/content/d/b/k/dbkguy/html/cron.php: line 2: //: is a directory
/var/chroot/home/content/d/b/k/dbkguy/html/cron.php: line 4: /Packages: Permission denied
/var/chroot/home/content/d/b/k/dbkguy/html/cron.php: line 5: backup: command not found
/var/chroot/home/content/d/b/k/dbkguy/html/cron.php: line 6: syntax error near unexpected token `('
/var/chroot/home/content/d/b/k/dbkguy/html/cron.php: line 6: ` * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).'

I just checked my logs and it says Cron has been running for more than an hour and is most likely stuck.

I called GoDaddy and they said cron was not running. I also deleted the cron job and retried it, same thing. Whats up with cron?

fuzzy76’s picture

This seems to you are trying to run cron.php directly as a command line script. You need to use curl or wget as described in the documentation: http://drupal.org/node/23714

TC44’s picture

In my case it was the auto-expire module that cron was hanging on.

I edited the module.inc file as per this thread: http://drupal.org/node/43075 and checked the logs to see where cron stopped.

Maybe that will help someone else.

davebv’s picture

I removed the "pingback" module, because I saw mysql errors naming that module, now cron run OK.

Unity’s picture

Cron has always worked perfectly for me. After installing three modules that ended up not working, and then removing them, cron no longer ran. My host's auto-message said that it failed to access *cron.php. Attempting to run cron manually from within Drupal gave me the same error.

After checking this page, I thought to simply type the url to my cron.php file, and it ran correctly, delivering a blank page. This completely fixed the problem. Cron autoruns correctly, and when I run it manually from within Drupal. Just wanted to let people know, in case this helps anyone else.

sportguy612’s picture

Im kinda new at this, but after 2 days of troubleshooting, I began using the Reindex module (which is great, thanks douggreen). Basically, my theory was that there were a few bad apples (or nodes) that were spoiling the entire run. By publishing/unpublishing content and reindexing, I isolated 4 or 5 nodes that would cause the reindexing to exit in http error 500. All five nodes were remarkably long (and I mean EXTREMEEEELLLLLYYYYY long).

Deleted these nodes, the reindex module completed and cron worked.

hope this helps someone

Mina Samaan
www.copticchurch.org/drupal6

m00nc0w’s picture

Hey!

I see that everybody have some problems with Cron.

Now I have the same problem and I found the solution (for me) :

It was the newsletter!! I Have removed all the subscriptions and now I can run cron successfully but no newsletter. Arghhh ...

I had the same problems I tried everything (cron_semaphore and all those methods) but nothing worked only this.

I post cause maybe somebody will just go insane like I did and maybe this will help him.

If somebody know how could I fix my problem please drop a reply or a PM. It would be just great!

~Thanks~

NancyDru’s picture

Any time a module causes problems, you need to post an issue against that module. Most likely, the maintainer is going to have to add a feature to segment the subscriptions to send fewer out at one time. Or you can increase the "maximum execution time" if your host allows it.

NancyDru (formerly Nancy W. until I got married to Drupal)

ferrangil’s picture

I just removed the variable as said in thousands of sites, but cron wasn't working at all!
Then, I just found another post where they said: and also clear the cache!!!
That worked for my site!

sito99’s picture

That I managed to fix via command line. I tried deleting the variables but had same issue. I ended up deleting the variables and when I did a check table with command below it showed an error for one of my tables. I ran the following commands and problem is solved...

mysql> CHECK TABLE tablename;
then I did a Repair table tablename;

popetardo’s picture

fixed for me too.

thank's

softsolvers’s picture

i do

abingabanger’s picture

i was reading this read trying to follow all the instructions.

deleted variables, installed poormanscron, deleted search index, and so many other things. nothing worked.

my Update Status was never enabled. it's always been disabled, so instead of disabling it - i tried the other way around. and guess what? it worked!!

4v4l0n42’s picture

Drupal 6.14 running on bluehost.

I Tried all of these:
Specifically:

  • Cleared cache on admin/settings/performance.
  • Checked the size of the watchdog, sessions or acceslog tables and truncate (empty) if needed.
  • Searched in the variables table for cron_last and cron_semaphore and deleted these entries.
    DELETE FROM variable WHERE name="cron_semaphore";
  • Began to disable suspect modules (those that call hook_cron) one by one and try to run cron manually every time, but then I got to the point that only the essential modules were enabled:
    • aggregator
    • dblog
    • filter
    • node
    • ping
    • search
    • statistics
    • system
    • trigger
    • update
    • date_timezone
    • googleanalytics
    • mollom
    • user_stats
    • votingapi

Any less than this and the website will become unusable. I disabled all notifications and newsletters, but still got no luck.

Now, I tried killing the PHP process from the server using SSH, and according to top cron is not running.

To put it simply, drupal says cron is running, so I can't run it again. The server says cron is not running.

Any idea?

HS’s picture

I have since realized that any Cron issues could have a lot to do with my shared host. When DreamHost has issues with their Database/Servers Cron may get stuck.

The following may be totally irrelevant and purely coincidental, but nothing recommended above has worked for me BUT these steps below.

1. Go to your hosting control panel and disable the Cron job.
2. Go to /admin/settings/performance and clear caches.
3. Go to /admin/build/modules and disable 'Update Status' and un-install - this has no adverse effects, you can just reinstall it once Cron runs.
4. Go to /admin/reports/status/run-cron and run cron.
5. Go back and enable cron on hosting control panel, enable update status if required.

These steps work every time cron is stuck for me. I hope it helps others.

nnnnmmmmarrrxxx’s picture

Worked for me, thanks!

karan.verma86’s picture

Instead of disabling search, running cron, enabling search or deleting cron_semaphore. Is there a permanent solution to the problem?

AdamM’s picture

Wanted to post how I solved my similar problem. I created the custom block from facebook-style statuses that is in the documentation, which was the problem (so I deleted it). I cleared cache, deleted cron_last from the devel module and then ran cron successfully. Thanks everyone for your help.

manderson725’s picture

Anyone have any idea what this error might indicate? This is the message I receive when running cron.php from a browser. When I disable the Search module, cron runs fine, so i know its something with the site index, i'm just not sure what exactly.

Fatal error: Class 'view' not found in /var/www/drupal6/includes/common.inc(1685) : eval()'d code on line 3

Diogenes’s picture

I enabled error reporting in cron.php and it was reporting timeout errors, even with max_execution_time set to 180. I kept disabling modules till I finally disabled the Search function (admin/build/modules - Core (optional)).

Then cron worked, even after adding every other module back in. So the Search module still has some issues.

alexmoreno’s picture

it also worked for me, thans a lot :-)

alexmoreno’s picture

i was speaking about this post http://drupal.org/node/143519#comment-244463

regards

soulston’s picture

You can also run cron through Drush:

drush cron

Junro’s picture

subscribe

robin1988’s picture

I have tried every single possibility :-

1.Disabled and uninstalled the update module
2.Deleted the semaphore and cron_last module
3.Disabled and uninstalled the simplenews module
4.Cleared the cache
5.Installed poormanscron and set it for 1 hour
6.Tried to run each module separately by Supercron module and everything seems to work fine except the search module .
7.Set the Search to index the site at 10 pages per cron
8.Returned to Supercron and again tried my luck :-( but didnt get it working (Some Fatal: Memory issue and i have 128 php limit)
9.Disabled Supercron and Poormanscron

In short i have tried all the combinations possible and may have forgotten some to list out here
AND i am unable to run cron

Running cron is the most basic operation i have to perform for my client since this is a news+media+job Portal
I need to get search working properly and i need to send those newsletters and i need to check for the RSS feeds
But i am stuck and all this has begun just cpl of weeks back
Hope to find a solution from this thread

robin1988’s picture

and hey did i failed to mention that now in my status reports it says that cron never run
and in my logs it shows that Attempt to re-run cron when it is currently running
and all this has been hapenning for past 1 hour

VM’s picture

sounds like cron is stuck.

I'd do a search on drupal.org for cron stuck or cron semaphore. It' should pull up previous users who run into this issue that I've read in the past.

NancyDru’s picture

You need to tell us which version of Drupal.

robin1988’s picture

Drupal 6.14
MySqlDatabase 5.0.90
PHP 5.2.13

today also it shows that cron never run
And i have set cron at my server to run every 30 min

robin1988’s picture

well my log entries say

Message Cron has been running for more than an hour and is most likely stuck.

Whenever i try to run cron manually

NancyDru’s picture

Drupal 6.16 introduced a change to the way this all works. I suggest upgrading core before doing anything else. BTW, 6.17 came out yesterday.

robin1988’s picture

Hey you seem to know lot about drupal can u please guide me what to do??
Which is the best and most stable or permanent solution
And if you want me to upgrade then please tell me how to upgrade m a beginner or just give me the link where i can get knowledge about how to upgrade thanx

AlfTheCat’s picture

Hey Robin,

Do you use open publish by any chance? Because I've had this weird issue with open publish (or some component of it, like feed api or more like this) where it overloaded my server about twice a day when some cron job was battering my server with something I couldn't even remotely identify. I only had a few feeds that were importing items at generally large intervals

I had to kill my open publish website for the time being.

I know this info is not very specific but since you've tried all the options and I notice you mentioning feed importing... Maybe you're looking in the wrong direction. Perhaps some other process is giving cron more than it can handle.

----
"People make mistakes. To really mess something up you need a computer."

robin1988’s picture

Hey you seem to know lot about drupal can u please guide me what to do??
Which is the best and most stable or permanent solution
And if you want me to upgrade then please tell me how to upgrade m a beginner or just give me the link where i can get knowledge about how to upgrade thanx

robin1988’s picture

Hey i finally got it running
I disabled the aggregator module
I disabled search module
I emptied all the variables which start or have problem word cron in it
I emptied the cache table also

And then Cron ran successfully hahaha :D but it is of no use then
When i enabled aggregator and i manually ran cron it did run successfully
But when i enabled search and i manually ran cron it did not run
And a Fatal error is shown which is demanding for more 71 bytes on line 448 for search.module
but here i would like to add that i already have 128M Php limit... Memory should not be problem
Plus i have settings for indexing only 10 nodes per cron search i dont know what is the problem or which table should i now delete
I have more than 13000 nodes and this is a media+news+jobs portal so search is quite important plus i have to enable simplenews for sending promotional mails

Please give me a permanent solution
Drupal has given me so much i dont want to hate it because of cron

NancyDru’s picture

...Memory should not be problem.. -- Memory is always a problem. The more modules you have, and in particular which ones are used on a page, the worse this problem gets.

The Search module can use a lot of memory if it is indexing large nodes. Aggregator can also use a lot. And if you have Update enabled, that can use a lot too.

Reduce your search limit to ONE (1) and try it.

If that works, then you have some decisions to make. You can keep your search limit very low (may not be a problem if new content is slow) and increase the cron frequency. Another choice that might work for you is to look at SuperCron and set it up to run parallel processes so that Aggregator and Search don't step on each others toes.

robin1988’s picture

Final word guys
Search module is the culprit
Now what do you suggest?? should i ask my hosting company to increase the php limit or do u suggest any other module?? i cant bring down search to index 1 page per cron since the last option i have is 10 pages to be indexed on cron..... or do u suggest me to upgrade?? just give me the final word.. and just keep in mind that i would have to enable simplenews module in future and boost module also

NancyDru’s picture

We pretty much knew it was Search.

Go into your database. Look in the "variables" table for search_cron_limit. It should currently say s:2:"10"; Change (type carefully) it to s:1:"1";; then save it. Now your search limit will be one.

I would definitely increase your PHP maximum execution time to at least 60.

I also strongly recommend that you consider upgrading core to the latest version. You may not have any problems if you do.

robin1988’s picture

well it dint work for me i did set the search to index 1 node per cron run
but cron seems to run perfectly but search doesnt seems to work even if i check in after like a week there is no progress and running it from supercron also doesnt helps
is there any other solution??? or i shud just give up :-(

AlfTheCat’s picture

Like nancydru said, famous last words on the memory part. For the open publish site I mentioned I used 256M of PHP memory and still it would sometimes get greedy for more. Up your memory and see if anything changes.

Try the Drupal tweaks module if you haven't done so already. It allows you to set a bigger max_join size value, you can increase your PHP memory (if you have the proper permissions for you server off course) and you can also increase your execution time (default is 30 seconds but for lengthy operations you may want 60).

With supercron enabled you can balance the tasks a bit more, if you succeed in finding out which process is slurping up resources. You may want to set cron to run every one minute (or so) to give you more scheduling freedom.

I guess Drupal's cron mechanism, where it runs a lot of tasks all at once every 45 minutes, needs a bit of tweaking when your website is importing content and does hefty chores. No need to hate it though, nothing but love for the blue drop :)

----
"People make mistakes. To really mess something up you need a computer."

nickgs’s picture

Simply removing 'cron_semaphore' solved this for me.

Thanks!

Nick

chien_fu’s picture

I removed this variable as well and it did not change anything until I increased the PHP memory limit to 128M.
Ran successfully!

cpo’s picture

since 13 decembre, drupal cron failed at 95%. I deleted variable "cron_*", empty cached, run manually...
(I think, my hosting provider seems to change variables php or mySQL...)

Any idea to solve my problem ?

VM’s picture

check the node it's getting stuck on; if always sticking on the same node. Is there something odd about the node that cron is getting stuck on?

NancyDru’s picture

I would wager that it is a PHP format node. One of the many reasons for not doing them.

Majdi’s picture

With my old host provider everything where working fine , just when i got new server i get this problem

also when i used ssh to download module using wget , the drupal site take time to response , like 10 sec , so maybe its the case with the cron job , with all the modules we have , the cron get stuck

thoughtcat’s picture

I've followed the instructions here for deleting the "semaphore" entry in the variables table using phpMyAdmin, but I'm still getting the problem. On my dev site it worked OK - there, cron hadn't run for 3 days, and I deleted "semaphore", ran cron manually and it was fine. On my live site (where cron hasn't run for just over 1 day) I am following the exact same procedure but keep getting either "cron run failed" or "500 internal server error". I've flushed my caches, updated all my modules, and core (6.20) is all up to date. I haven't installed any new modules in the past 24 hours or for a while, in fact. Any ideas?

NB This all started because I got a user warning - duplicate entry...themes message on my live site today, which I haven't had before, although often get it on my dev site. One comment in that thread suggested to run cron, which was when I noticed it hadn't run for a bit longer than usual.

There are no cron jobs set up in my cPanel. I have Poormanscron installed on both live and dev sites.

NancyDru’s picture

Are you using search? Has it completed its indexing? (I bet not.) Do you have nodes that are php format containing code? Get rid of them.

thoughtcat’s picture

Thanks - I checked again this morning and the status report was saying cron hadn't run again for 2+ days. So at some point since my original post it had run. No amount of deleting the "semaphore" variable in the database, flushing caches etc has made it work. When I checked search as you suggested, it hadn't finished indexing - it was at 99% with 1 item left to index. I've set it to reindex and it says there are 130 items left to index. There aren't any php nodes - I take it you only mean actual nodes, as opposed to content templates and blocks? I've not configured any blocks manually with php although obviously some are views etc for which there is no "configure" option.

thoughtcat’s picture

My search has reindexed only 2 items since I posted my reply above. Not sure if this is normal. I changed the search settings from indexing 100 items per cron run to 10, and also changed the cron itself from running every 3 hours to running every 1 hour. *confused*

thoughtcat’s picture

Indexing is now at 3%, but in the meantime cron has managed to run :-/

chrlvclaudiu’s picture

Hey everyone,

I know that maybe this issue was already solved, but for those who still have problems with cron you should
delete the "cron_semaphore" variable and clear the cache (i think this is the most important step).

Good luck,
Claudiu

vin247’s picture

Just had the problem recently,had set cron to run every hour and noticed it wasn't running, removing cron_semaphore did the trick!

rodmarasi’s picture

i've done nearly every possible solutions posted in this posting but not working.

i tried this method my self and it works like a champ.

1. install elysia_cron module and enable it
2. go to site building > cron setting status
3. "run" all the modules listed individually. you can see it is successful if a number added at "execution count"
4. you will see a module that cannot be run and the execution count is "0". this module is the culprit.
5. uninstall the module and run your cron manually.

works for me after hours of scratching my head.

belajar drupal, makan drupal, tidur drupal

krishanchandra’s picture

When we enable developer module and after Run Cron then Cron not run successfully So please mind it.
disable Developer Module and run cron.

knalstaaf’s picture

Exactly: turn off the Devel module before running cron (or before creating a backup with Backup & Migrate module, or you'll have a large database backup).

dhcadmin’s picture

Drupal 6.22
Ultimate Cron 6.x-1.7
Ubuntu Lamp stack

This rackspace virtual server is a test clone of another server rackspace virtual server. The original server is not having this problem--cron is working fine there.

When I cloned the server I forgot to re-point the crontab to execute the cron on the new server. For a day or so it executed the cron.php on the original server. Then I noticed the extra load on the original server and found my oversight. I changed the url in crontab on the clone server to point to the clone server. It ran fine like that for about a week. Then it stopped.

When I view the /cron.php file in my browser I get a blank page, and the 'cron last run' entry on the status report updates.

Whether I execute cron manually from that page page or from the 'run cron manually' link on the status report, it looks like cron has fired.

When I go to the /admin/settings/cron page to view the Ultimate Cron list of cron entries, all enabled modules have an hourglass status. Everything starts, but nothing completes. I've let it run for hours, and nothing completes. I've tried disabling everything except the core modules, and even with only these processes enabled, they still won't complete:
Progress
Background Process
System
Ultimate Cron

I have deleted the cron_semaphore with no luck.

The dblog is silent on these cron failures.

How do I get more diagnostic data?

vin247’s picture

if you can ssh on try php cron.php to see if it outputs any errors

chunty’s picture

I know this is an old post but it kept coming up in my searches for a fix so in case it helps anyone. I tried all the normal suggestions like disabling PHP filter etc to no avail and my problem turned out to be a node with some stupidly crazy html that had come from an RSS feed. I posted how to find that node here: http://tappetyclick.com/blog/2013/01/14/how-find-bad-node-makes-search-i...

Hope it helps

alexmoreno’s picture

old post, current problem. This module is very useful to debug this kind of problems: http://drupal.org/project/cron_debug

mp’s picture

Ramandeep_Kaur’s picture

Hi all,

Although this is an old post and the issue might have been resolved for many people, still i would like to post how i was able to solve this issue.

I am using drupal 7 and cron would not run on the production server . I was always getting the memory error. I installed the cron_debug module for drupal 7 and ran cron individually for each module. Then i found out that it was the apachesolr module which was stopping cron from running. I then figured out that apachesolr settings had 200 items to be indexed in each cron run.
I reduced it to 10 and viola!! my problem solved..

Hope this helps someone.

EJx64’s picture

I too realize this is an old post, but figured i'm submit some findings in case it helps someone:

Cron appears to check many things, even php files that are included on nodes to be run as PHP code.

Basically, I have some custom PHP files that I include in various ways. Cron was getting stuck on checking those apparently, i had to move my site and hadn't gotten those restored into place yet.

Also, cron was getting stuck on referenced fields in the database. Once I had all my referenced PHP and database items back in place, cron was able to run again.

urix’s picture

D7, as mentioned above - it's a modules problem.

In my case, it was LinkChecker module that tried to check too many external links.
More than 900 links at once was too much for my installation, however on the module's help page mentioned that it's required to install HTTP Parallel Request & Threading Library only on sites with 30000+ links.

Anyway, how I found out it: installed https://www.drupal.org/project/elysia_cron module and tried to run cron.

Immediately got error about LinkChecked module, disabled it and cron runs again.