Cron should be disabled for disabled sites

omega8cc - October 16, 2009 - 03:02
Project:Hosting
Version:6.x-0.4-alpha2
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Currently, even if the site is disabled, cron still runs for that site, which can be serious overhead on small servers with ~1 GB RAM and ~35 sites, some we heavy distros, like Tattler or Open Atrium etc.

This goes even worse, because there is no way to configure how many sites gets invoked cron - it defaults to 5 per run, while should be also configurable, like it is for drush tasks.

#1

omega8cc - October 16, 2009 - 03:04

[edit] "some with heavy distros"

#2

mig5 - October 16, 2009 - 03:09

edit: bah, ignore this comment.

#3

mig5 - October 16, 2009 - 03:12

This is odd, how are you tracing that cron is being called on a disabled site? So I can try and reproduce

The query is from hosting_cron_get_sites() and the query is this:

<?php
db_query
("SELECT n.nid FROM {node} n LEFT JOIN {hosting_site} s ON n.nid=s.nid WHERE n.type='site' and s.status = %d ORDER BY s.last_cron ASC, n.nid ASC limit %d", HOSTING_SITE_ENABLED, $limit);
?>

So I'm having trouble finding how it could include a disabled site, unless somehow the disabled site's status has not been changed in the db.. but then it wouldn't appear as 'disabled' in the frontend if this was the case.

When I disable a site, I see the number of sites in the 'Frequency' drop as expected.

#4

omega8cc - October 16, 2009 - 03:28

I noticed that after I disabled most of test sites (with easy to remember subdomains) but then, when crons were invoked, I observed a little too high server load and just checked ps axf to see what is it and found all disabled sites running cron, while these sites are visible as "disabled". I don't suppose I have Aegir db messed enough to get such results, since everything works as expected otherwise.

#5

mig5 - October 16, 2009 - 03:46

Hmm I can't reproduce this on HEAD. I'm running a 'watch -n1 "ps axf | grep php"' and when cron comes around (in my case, i've the queue running 'once per second'), only Enabled sites are being executed. Disabled sites (status = '-1' in the database) are not being run.

I'll try and reproduce on 0.4alpha2.

#6

omega8cc - October 16, 2009 - 04:10

Another odd behavior I noticed: even if cron is set to run every hour (for sites) it runs anyway.

And now something really odd: this screen http://skitch.com/omega8cc/ndcbi/fullscreen says the cron was run 10 minutes ago, while the site displays info about cron last run 1 day 1 hour ago: http://skitch.com/omega8cc/ndcny/fullscreen

#7

mig5 - October 16, 2009 - 08:00

omega8cc is this on 0.4alpha2 ? Or are you running 0.3 still? I'm not reproducing this.

#8

omega8cc - October 16, 2009 - 17:11

@mig5

This is running on @anarcat git, but with master/master.
An this is an upgrade from 0.3 (not fresh install)
Should I try it with just cvs head, maybe?
Will try to debug this better.

Thanks

#9

omega8cc - October 16, 2009 - 18:55

Anyway, why not to allow "Items per run: 5" to be configurable?

It doesn't help at all when I can only set "Frequency", since to avoid high loads from cron running on Tattler and other heavy RSS sites, I need to be able to set how many simultaneous crons will run, so I can set "Frequency" to 3 minutes and "Items per run" to 1 (one) because I don't want to increase httpd/PHP and MySQL limits (timeouts etc) only to avoid frozen cron on some sites, because it makes entire system open to DoS attacks.

#10

omega8cc - November 5, 2009 - 02:34
Status:active» fixed

Now I also can't reproduce this. Consider as auto-magically fixed and closed.

#11

anarcat - November 5, 2009 - 02:42

See #366387: cronjob queue not aggressive enough for the tasks per run settings and other...

#12

System Message - November 19, 2009 - 02:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.