Closed (fixed)
Project:
Subscriptions
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
28 May 2006 at 23:44 UTC
Updated:
9 Jun 2006 at 00:28 UTC
Jump to comment: Most recent file
After upgrading to drupal 4.7.x and upgrading to the 4.7.0 subscriptions module, said module is now sending out 100's of notifications to folks not subscribed to the threads, taxonomies, etc for which they are being notified.
Please advise what info needed to troubleshoot.
mysql 4.1.19, php 4.4.0, apache 2.0.58.
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | subscriptions_3.module | 37.4 KB | dziemecki |
| #18 | subscriptions_2.module | 37.4 KB | dziemecki |
Comments
Comment #1
dziemecki commentedAre you sure they are not subscribed? Do you have "autosubscribe" set to "On" by default? Could they be subscribed to a node type, rather than a node? A category? Check the subscriptions DB table for anyone who claims to have recieved an unsolicited subscription and look for their User ID. What does it say they are subscribed to?
Comment #2
srlinuxx commentedNot very scientific I know, but after the upgrade I noticed the number of emails going out had dramatically increased upon posting new story(s). Previously I had about an approximate dozen notifications going out, and all of a sudden after the upgrade it was 100's. I thought I had been hacked by a spammer at first. So, I shut down the mta and looked thru the mail queue. It was drupal mail. I've seen the names (email addy's) of my subscribers scroll by on my terminal for over a year, I'd recognize them. Many of those in the queue I had never even seen before. And one in particular, I know he wouldn't subscribe to anything from /my/ site.
Then I got about 3 emails back as a courtesy exclaiming that they are not subscribed to anything. One stated he doubled checked his subscriptions page to make sure.
And then there's this follow up to my forum post here stating he's seeing the same:
http://drupal.org/node/66017
As far as checking the database, I could with some help with syntax, but I cleaned out the queue so those last emails could not be sent and I disabled the module. I'd be glad to do whatever you need to pinpoint this, but my level of experience with mysql is limited to a few commands.
Comment #3
dziemecki commentedWell, you need to start off trying the stuff I suggested in the first post. As for mysql, don't bother dong any mysql commands - I'm suggesting you use whatever tools come with your database (like phpMyAdmin or mySQLcc or whatever is there) to just browse the table. I'm still not convinced this is a bug so much as a by-design-feature not being fully understood. I think.
Comment #4
venkat-rk commentedHi Dan,
I faced the same problem just today after upgrading to 4.7 and installing the 4.7 version of subscriptions module. Nearly one hundred users of my site (including me!) got content notification emails to taxonomy terms etc they had not subscribed to. I had to turn off the module in a hurry but the damage had been done by the time I noticed it. Some users reported receiving upto 70 such emails.
This was a nonprofit network, so the people were polite and I sent an apology:(
Comment #5
dziemecki commentedCan either of you tell me which options in the module set up you have activated? Can you list out steps by which I can duplicate the mailing of a notification to an unsubscribed user? If I can duplicate it, I can fix it.
Comment #6
venkat-rk commentedI will give the details of user wise subscriptions tomorrow, but this basically happened after I simply installed the 4.7 module on the upgraded site (4.6.5 to 4.7) and enabled it.
Comment #7
dziemecki commentedWhile I'm waiting on somebody to get back to me with some specifics, this just occured to me: I've modifed the table structure for mySQL tables and didn't really advertise it:
DROP TABLE IF EXISTS subscriptions;
CREATE TABLE subscriptions(
sid int(10) unsigned not null,
uid int(10) unsigned not null,
stype varchar(25) not null
);
stype is now 25 characters long where it used to be 4. Not sure if that is an issue, but it might be.
Comment #8
srlinuxx commentedI was just thinking/writing that I don't think I ran the .mysql or .install scripts cuz I didn't want my subscribers to have to re-up. most won't. I was just wondering if that was the problem. But wouldn't dropping those tables lose user info?
Comment #9
dziemecki commentedYes, it will. If you don't know how to alter the data type info directly, you can try this script:
ALTER TABLE `subscriptions` MODIFY `stype` varchar(25) NOT NULL default '';
... give or take some punctuation, depending upoin what you are using.
Comment #10
srlinuxx commentedI was able to alter the table, but it's still sending out 100's of notifications.
Comment #11
dziemecki commentedI'm wondering if several truncated entries were made before you did that. Maybe you want to run something like this:
DELETE FROM subscriptions WHERE stype= 'type';'type' is an invalid stype, and might be the result of a too-short data field.
I'm not positive about this, but I still am not able to duplicate this on my system, so I'm having to guess about how yours might differ.
Comment #12
dziemecki commentedAnother option to test:
I think this has somethng to do with pre-existing subscriptions and the "node type" subscription option. If one were to comment out the calls to the node type subscriptions, this might go away:
$strsent = $strsent . subscriptions_mailvars($nobj->type, $nobj->nid, $user->uid, 'type', $strsent);and...
$strsent = $strsent . subscriptions_mailvars($node->type, $node->nid, $user->uid, 'type', $strsent);To 'comment out' is to add a "//" to the front of line. e.g.
//$strsent = $strsent . subscriptions_mailvars($node->type, $node->nid, $user->uid, 'type', $strsent);This is a new feature so you won't miss it. If this works, you need to make the menu options go away, too. I'll give you the code for that here. This will at least give us a little more time to see what we can do to get the data up to the new standard.
Comment #13
srlinuxx commentedI think that commenting out that new feature worked, there wasn't a column "type." uid 1 still has menu item, but users don't.
Comment #14
dziemecki commentedThe column is "stype", not type.
Glad to know we can at least determine which feature is causing the problem. I've rolled the branch code back to the last known good build, but yours has a few more features the way it is. I didn't filter the menu on user (although you might have with permissions). To finish the clean up, comment out the twi sections that look like this :
and
I'm almost positive this is related to legacy data in the subscriptions table, but I'll see if I can prove that.
Comment #15
brashquido commentedCommenting out that code seems to do the trick.
The behavior of this bug seems to be that notification e-mails are sent to everyone who has any sort of subscription active. For example if you have a single thread subscription then you are also sent all notifications for other threads, all content types and all categories. If a user does not have any subscriptions active, then they aren't effected by the bug. I have tested this on a clean install of Drupal 4.7.1 with Subscriptions 4.7 running both IIS and Apache using PHP 4.4..
Also seem to have an issue where notifications are not sent when a node is updated and there are valid subscriptions for that node. I'll log this under another bug report though.
Comment #16
dziemecki commentedBeauty feedback, brashquido. You have a second career in QA awaiting you. I'll see if I can fix this manana.
Dan Ziemecki
Comment #17
srlinuxx commentedYep, thank you for working on this. I think it's working.
Comment #18
dziemecki commentedI think I got this licked. I had to change a 'd' into an 's'. Can one of you guys confirm this on your system before I roll this out to the ROTW?
Comment #19
srlinuxx commentedWhich "d" needs to be an "s" and is that with or without the new feature enabled?
Comment #20
dziemecki commentedThe 'd' and 's' thing was probably more detail than you really needed. The fully featured and debugged subscriptions.module was attached to my previous post.
Comment #21
brashquido commentedI haven't made any DB alterations Dan, and I get this error now when submitting a story regardless of wether there are any active subscriptions for that thread/category/content type or not.
Unknown column 'typestory' in 'where clause' query: SELECT u.mail, u.name, u.uid, u.language FROM users u INNER JOIN subscriptions s ON u.uid = s.uid WHERE s.stype =typestory in D:\iisroot\drupal\includes\database.mysql.inc on line 120.Comment #22
dziemecki commentedsigh.
Is it only for Story nodes? I wasn't testing against that node type and didn't get that error.
Comment #23
srlinuxx commentedoops, sorry, didn't see the attachment until after I posted.
But it does indeed only send out to those previously subscribed as it should, but now I get this database error in the logs when posting:
Unknown column 'typestory' in 'where clause' query: SELECT u.mail, u.name, u.uid, u.language FROM users u INNER JOIN subscriptions s ON u.uid = s.uid WHERE s.stype =typestory in /usr/local/apache2/htdocs/includes/database.mysql.inc on line 120.
Comment #24
dziemecki commentedBoth of you appear to be getting un-enclosed strings in your query string. Don't know why I don't but I've attached another version that hard-codes the string wrappers. Works for me. Of course, so did the last one.
Comment #25
srlinuxx commentedThat's seems to have done it. Only subscribers notified and no errors.
Comment #26
brashquido commentedNo, it was happening for page content type as well for me. You seem to have this issue sorted already though.
Tried the new module code, and it seems to be working fine. I seem to have stumbled upon that delayed notification issue we spoke of some time ago, but I suspect that is an environment issue. I'm going to start a fresh again as I have installed a few other modules on this test site since yesterday.
Comment #27
brashquido commentedOk, I think I've got the problem cornered now. It originally looked like that delayed send issue I had a while back, but it appears to be different.
Started again with a fresh install of 4.7.1 with subscriptions_3.module from above as the only installed contrib module using all default settings. Subscription e-mails are now sent correctly for thread and content type level subscription, but no subscription e-mails are sent for cateogry level subscriptions. The watchdog logs show nothing and nothing is coming into my test email accounts. I tested this using PHP 4.4.1 using both Apache 2.0.55 and IIS 5.1, and the behaviour is consistent across both webservers. Seems to be an issue when taxonomy subscriptions are involved?
Comment #28
dziemecki commentedI was unable to dupe the taxa problem, and it would not be related to the change I just made. Please submit that as a separate issue. I'll close this one and commit the code so that no one else has to deal with the unrequested notifications issue.
Comment #29
dziemecki commented1 week, no follow up. Presuming closed.