The system keeps sending twice notifications to each subscriber after a new blog entry is posted (see attached).

At the beginning, I noticed that many subscribers had two entries in the "subscriptions" table in the MySQL database. I cleaned the data table and left single entry for any "recipient_uid".

I thought that would fix the problem. However, I noticed the system remain sending the notifications twice to many subscribers as the attached indicated.

Any solution for this? Thanks

Comments

salvis’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

I've never seen this — there must be something strange with your site, maybe even a bug in the logging.

At 1.3 you're somewhat behind. Try updating to 1.4, or even better to the -dev version. If that doesn't help, then try to reproduce this on a virgin test site.

ssun’s picture

Hi, Salvsi, it is not just logging because some people complained to us that they received duplicated emails. Is there anything you could think that I should check with?

salvis’s picture

It's normal to have multiple (slightly different) entries in the {subscriptions} table as well as in the {subscriptions_queue} table.

The subscriptions_cron() function should remove all {subscriptions_queue} table entries that refer to the same node after it has sent the first notification for that node. Do you have a third-party Subscriptions submodule installed?

ssun’s picture

StatusFileSize
new131.19 KB
new122.43 KB

Salvis, I don't think I installed any 3rd party subscriptions sub_module installed(see attached: subscriptions-module.jpg). Interestingly, after a new blog entry was posted today, it seems that the first cron sent many users duplicated messages (I could not find log entries for those, not sure why). However, all the users included in the second cron cohort seemed to receive only 1 message (see attached: subscriptions-watchdog-entry.jpg). The log entry also provided a summary at the end of the second time of running cron:

Subscriptions sent 2858 single and 0 digest notifications in 197 of 240 seconds; 0 queue items remaining, 42 seconds left for other cron client modules.

I set up the cron.php to run every 5 minutes. Do you have any possible theory(ies) for the duplicated messages produced in the first cron running period? Thanks as always.

salvis’s picture

What makes you think there were duplicates in the first round? Users complaining? Could it be that they have more than one account?

I don't have any clue as to why this could be happening...

ssun’s picture

StatusFileSize
new137.81 KB

Hi, Salivs, today I found that duplicate notifications were caused that the cron.php ran twice (see attached). At the cpanel, I only set the cron.php to run every 10 minutes with the following command:

/usr/bin/wget -O - -q -t 1 http://www.utcinsight.org/cron.php

What could cause the cron.php to run twice? Could it be twice click the "save" button by the author?

Thanks

ssun’s picture

Hi, Salvis, I think I figured out how the cron.php sometimes ran twice at the same time. I checked the server and found out that I mistakenly set the www.utcinsight.org/cron.php to run at every 15 minutes at another account while it was set to run at every 10 minutes at the right account. I deleted the cron job at another account and I think this will fix the problem (I really hope so).

salvis’s picture

It's still weird, because cron.php is supposed to guard itself against being run more than once simultaneously. Do you have multiple sites running off the same database or mirrored databases or something like that?

ssun’s picture

No, I don't have multiple sites sharing the same database. The watchdog information seems to mean that cron.php ran twice at the exact time and it caused duplicate notifications to be sent to each subscriber. So I searched at the server (VPS) and found that, at the same server, I created another domain account a few months ago. Although I never really use that account, but not sure why, I put a cron job at the Cpanel. Other than that, I really can't think any other causes. Now I only can hope this issue is gone.

What you mentioned that cron.php is guarded from being run twice at the same time seems to be true, EXCEPT when the site has notifications being sent out. I said so because usually I noticed cron.php ran ONLY ONCE (i.e., one entry of "cron run completed" in watchdog) every 10 minutes as I set up. It's just over my head.

ssun’s picture

Salvis, see this one: http://drupal.org/node/728752.

salvis’s picture

If you look at the function drupal_cron_run() in includes/common.inc, you'll see that it uses a variable called 'cron_semaphore' to make it virtually impossible to run twice in parallel. If cron_semaphore is set you cannot get into the else part where the processing is done.

The mechanism in place is not bullet-proof, but it should usually work.

There is something weird going on and you need a local specialist to look into it.

salvis’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)