Poormanscron runs 3 times in a row
| Project: | Poormanscron |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Strange... I noticed in my Watchdog logs that Poormanscron (on Drupal 5.7) is running 3 times in a row. The whole series of cron jobs is done, without any error messages, but it is immediately repeated two more times, all at the same time.
I haven't changed anything before or after the time this peculiar thing started. No serious site activity has been taking place, no bulk uploads or anything.
I don't run my own server. I depend upon the work of the "computer people". So, I can't get to any Apache or PHP logs or settings.
I can, however, reach my own MySQL tables.
I have no clue as to the origin of this threefold activity. I assume / hope is "something" on the server level?
Does anyone have an idea regarding the causes of this weird behaviour? And what could I do to bring Poormanscron back to 1 run instead of 3?

#1
Still looking for clues here. Why would Poormanscron run 2-3 times at the same moment? Why would it do a cron job after it has just done so? And how can I tell it not to do so and to simply run once every hour, the way it is meant to do?
#2
It's getting worse... Poormanscron is running at random, sometimes every 2 minutes (and it's set to run once every hour...). Furthermore, I noticed a search_cron which took 17 minutes (minutes, that is). Nothing new has been added to my site, and admin/settings/search claims that 100% of my site has been indexed! What the heck is happening???
Ever since this cron business started (last Friday), my site has been working at a very low speed. Devel tells me that the query time is what it has always been, but that the Page Execution Time has become very bad: sometimes up to 23000 ms., 23 seconds that is, or sometimes the page doesn't show at all (but my browser's source view tells me that it is there: the full source is shown, but the page itself isn't). I don't know if all this mess belongs together, but I would sure like to sort things out!! Any help would be Really welcome...
#3
Getting slightly desperate... In what direction should I be looking to get rid of this overly eager cron business? Hints would be so welcome...
#4
If you run cron manually does it run quickly/slowly?
Suggest you turn on progress logging in poormanscron settings to see if a particular cron hook is taking a long time. If you look in the actual {watchdog} database table you can get the timestamp of the entry to the nearest second which should help you see what is taking the time ...
If the server is generally overloaded then it's quite easy to get race conditions as poormanscron_exit() starts up, leading to multiple concurrent threads running all the cron hooks. This has been reported before - you'll probably find info if you search the issue queue. It doesn't look as though a fix ever made it into the module though.
[Update: see for example #43511: Race Condition in the code. ]
#5
i can corroborate this... i've noticed it in several drupal sites i maintain, both running drupal 5.12, a few with poormanscron 5.x-1.1 and one with the february 5.x dev build.
i haven't been able to track down the issue, but i'm not sure it's a race condition. one of my sites has a fairly slow cron cycle, and manual tests showed that its normal cron activity is fairly minimal.
i'm attaching a screen cap of the cron logs. will post back here if i discover anything.
/b
#6
Please see #43511: Race Condition in the code. for the root issue of this problem.