Simplenews users using poormanscron to send newsletters experience problems with multiple emails send to a single subscriber. This seems to be caused by poormanscron being triggered by different visitors opening a page within the time the cron job runs. Can you confirm that this situation can occur with poormanscron? In Simplenews I can reduce the damage, but my advise to simplenews users is not to use poormanscron. Is this something that can be solved in poormanscron?

Comments

gpk’s picture

Yes if you look through this issue queue you will see that this is a known problem. cron actually uses a special flag (cron_semaphore) to try to prevent multiple simultaneous cron runs. The problem is a little more subtle than you describe: If visitor B makes a page request while a page request is running for visitor A, and if visitor A triggers the cron run (the check is made at the end of the page request processing), then although visitor A will cause the cron_semaphore flag to be set, visitor B will not see this (since the static variables are all instantiated right at the start of the page processing). Hence visitor B will also trigger the cron run.

Note that the only version of poormanscron to use the cron_semaphore flag is 6.x-1.x-dev; however similar problems occur in the other versions. I think there may also be a problem with the arithmetic in poormanscron_exit() which exacerbates the problem in certain situations.

In principle it can be fixed, if anyone has the time/inclination. Actually IIRC a fix is described in detail in one of the old issues here (probably 2 years old or more).

dave reid’s picture

Status: Active » Closed (duplicate)