Ticket #136 (closed defect: fixed)

Opened 6 years ago

Last modified 3 years ago

dev server sending messages to users

Reported by: ed Owned by: chris
Priority: critical Milestone:
Component: Dev server Keywords:
Cc: jim, john Estimated Number of Hours: 0.0
Add Hours to Ticket: 0 Billable?: yes
Total Hours: 0.15

Description (last modified by chris) (diff)

the dev server has been sending messages to users. this is confusing them a lot, and shouldn't be happening. please make it stop pronto!

i can't login to the dev server for some reason either...

here's one:
From: site@… site@…
Sent: Friday, September 17, 2010 2:07 AM
To: Nicole Brammy
Subject: New Transition Network News: Climate Change Poetry Competition

Greetings Nicole Brammy,

This looks fun. A climate change poetry competition. Thanks to Emily and Diana for recommending it.

Climate change is happening now – write now!
Climate change - we hear about it all the time, we see the floods, the food riots, the migration. We reuse our plastic bags, switch off our lights, get out of the car and onto the bus. We see our own weather changing, the late summer, the heavy rain, the mosquitoes. But not a lot of people are writing poetry about it. Poets, as Percy Bysshe Shelley said ‘are the unacknowledged legislators of the world’.

So get writing!...

Read more http://dev.transitionnetwork.org.webarch.net/news/2010-09-16/climate-cha...

--
This is an automatic message from YOU ARE LOOKING AT DEV
To manage your subscriptions, browse to http://dev.transitionnetwork.org.webarch.net/user/4214/notifications
You can unsubscribe at http://dev.transitionnetwork.org.webarch.net/notifications/unsubscribe/s...

Change History

comment:1 Changed 6 years ago by chris

  • Cc jim, john added

I'm sorry but I don't know what has caused this but I have set the email address for all users in the dev and test databases to transition-dev@…:

mysql> update users set mail="transition-dev@email-lists.org";
Query OK, 7864 rows affected (2.12 sec)
Rows matched: 7864  Changed: 7864  Warnings: 0

So the emails should all be set to the dev list that was set up for this, https://www.email-lists.org/mailman/listinfo/transition-dev

I have also stopped the cron job on the dev server for now as well.

Anyone have any idea what could have caused this?

comment:2 Changed 6 years ago by chris

Regarding the login problem, I have reset ed's email address:

mysql> update users set mail="edmitchell@transitionnetwork.org" where name="Ed Mitchell";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

Now, in theory, you should be able to request a new password and try to login again, though this doesn't seem to be working for me...

I have renabled the cron job.

comment:3 Changed 6 years ago by chris

I can get the dev site to send me a one time login url after resetting my email address however I'm unable to login to the site using this url... hmmm...

comment:4 Changed 6 years ago by chris

Logins work now, I changed this line in /web/dev.transitionnetwork.org.webarch.net/www/sites/default/settings.php:

/* chris 2010-09-27
$cookie_domain = 'dev.transitionnetwork.org.webarch.net';
*/
$cookie_domain = 'dev.transitionnetwork.org';

Ed -- try logging in now.

comment:5 Changed 6 years ago by chris

The Reroute Email module, http://drupal.org/project/reroute_email is installed and enabled, see:

https://dev.transitionnetwork.org/admin/build/modules/list#edit-status-reroute-email

These are the instructions form the README.txt with this module:

Configuration
-------------
To enable this module do the following:

1. Go to Admin -> Modules, and enable reroute email.

2. Go to Admin -> Settings -> Reroute email, and enter an email address
   to route all email to.

This module is enabled in settings.php on the dev and test servers:

/**
 * Reroute Email 6.x-1.x-dev variable to send emails to a different address for DEV
 * 
 * JK - this is DEV so am rerouting emails!
 */
$conf['reroute_email_enable'] = 1;

I couldn't find where to set the email address it sends email from via the web interface so I have added this settings.php for both the dev and test servers:

$conf['reroute_email_address'] = "transition-dev@email-lists.org";

I assume the sites have now stopped sending emails to users, in addition no emails have come to the list address that they should be sent to.

I'm not sure what more, if anything, I can do on this.

comment:6 Changed 6 years ago by chris

Looking at the mail log for today:

grep "status=sent" /var/log/mail.log | grep "Sep 27" | vim -

There have been 67 email sent today, all to developers apart from:

nikki.marshall @ xtra.co.nz - 2 mails
issamenezes @ globo.com - 2 mails
nicnik @ internode.on.net - 2 mails

I haven't yet tracked down why these emails were sent but it's a relief to know that it only looks like 6 emails were sent that shouldn't have been...

comment:7 Changed 6 years ago by ed

Thanks Chris,

Jim had a lot of fun with cookie domain stuff a short while back - login mayhem - we think it nailed bug #40 in passing too. Perhaps the fix was on live not dev?

I still can't log in to dev, so have requested a new password and will see. The plan is for me to get in there and neutralise the user accounts (their alerts settings) in question at the least to keep the emails out of their inboxes.

comment:9 Changed 6 years ago by chris

Yes the cookie fix hadn't been applied to the dev server.

There is no need for you to anything at the moment -- emails are being sent but all now go to this list:

https://www.email-lists.org/mailman/listinfo/transition-dev

I have added you to this list so you will also get the emails, the ones sent today are about imported blogs, eg:

Subject: Update for Imported Blogs: A Discussion about ‘Ways of Knowing’ in  Transition … 
Subject: New Imported Blogs: A Discussion about ‘Ways of Knowing’ in Transition  …

If you don't want to get these emails we can set it so they are not sent but you will still be able to view them via the web archive if needs be.

Basically the issue seems to be that the reroute email module doesn't reroute email about new and updated imported blogs if a users has opted to get emails about these?

comment:10 Changed 6 years ago by chris

So what is sending the emails?

I wondered if it had anything to do with the settings in the og_notifications table, but some users have autosubscribe in this table set to -1, some to 1 and in total 6849 users have it set to -1 and 992 set to 1 so the thing that triggers these emails must be elsewhere...

comment:11 Changed 6 years ago by jim

  • Status changed from new to closed
  • Resolution set to fixed

Hi all... Hmmmm........

  1. Reroute email is in site config->reroute email. You may not have had permission to access it, but it definitely is ON and rerouting to "transition-dev@…". It's set to ON in settings.php. I've applied Chris' hard-coding fix to the 4 settings.php files.

FYI ALL: They're at:

  • [DEV]/sites/default/settings.php
  • [DEV]/sites/workspaces.dev.transitionnetwork.org.webarch.net/settings.php
  • [TEST]/sites/default/settings.php
  • [TEST]/sites/workspaces.test.transitionnetwork.org.webarch.net/settings.php
  1. I thought one of the last things I did was to add the old reroute settings in. Perhaps I ballsed this up, really sorry if that's the case.
  1. The cookie domain change was wrong. It cannot be significantly different to the actual domain because of Secure Pages and it's anti-hijacking add-on. The correct cookie domain for DEV is "

.dev.transitionnetwork.org.webarch.net ==" (note the . at the start)

. I've now rolled this correct pattern out across the DEV and TEST sites and stripped any extra stuff from the 4 settings.php files. Oh, and I don't think $base_url should be set at all in settings.php, since Secure Pages does its own thing anyway.

  1. Doing (3) has fixed the login issue, though i've always been able to login in on DEV - which is strange...
  1. The Reroute Email module uses Drupal's hook_mail (http://api.drupal.org/api/function/hook_mail/6) to override the destination of every email sent. A possible route for emails to miss this is if module weights are not arranged right and, say, the Notifications module gets there first. Hence ALL modules doing things right use hook_mail rather than PHP's mail() function. It's possible, though extremely unlikely, that this is the cause.
  1. The main sources of emails will be from the Messaging and Notifications modules. Importing blogs/news will create content which will email anyone who as asked to be kept abreast of it. Again, these modules definitely implement the correct hook_mail call, so they will be rerouted.
  1. I also reckon DEV does not need cron running at all. Test should IMHO as it needs to behave like

So it looks like I may have not done something right on reroute email when I re-synced DEV and TEST with LIVE. I'm absolutely certain I spent a few minutes on each site making sure it was in place though.

Finally, I reckon certain modules do not have a place on TEST or DEV, unless they're being actively developed for. These include the Messaging and Notifications modules mentioned before, plus the feed importer and mailchimp integration. I also think that these sites should be put into maintenance mode when not in use. What do we think? A quick SQL script to turn these off should be part of any automated or manual sync with LIVE process IMO.

comment:12 Changed 6 years ago by chris

  • Status changed from closed to reopened
  • Resolution fixed deleted
  1. The cookie domain change was wrong. It cannot be significantly different to the actual domain because of Secure Pages and it's anti-hijacking add-on. The correct cookie domain for DEV is "

.dev.transitionnetwork.org.webarch.net ==" (note the . at the start)

. I've now rolled this correct pattern out across the DEV and TEST sites and stripped any extra stuff from the 4 settings.php files. Oh, and I don't think $base_url should be set at all in settings.php, since Secure Pages does its own thing anyway.

But the certificate is for *.transitionnetwork.org so I think it would be better to use dev.transitionnetwork.org and test.transitionnetwork.org wouldn't it?

  1. The Reroute Email module uses Drupal's hook_mail (http://api.drupal.org/api/function/hook_mail/6) to override the destination of every email sent. A possible route for emails to miss this is if module weights are not arranged right and, say, the Notifications module gets there first. Hence ALL modules doing things right use hook_mail rather than PHP's mail() function. It's possible, though extremely unlikely, that this is the cause.
  1. The main sources of emails will be from the Messaging and Notifications modules. Importing blogs/news will create content which will email anyone who as asked to be kept abreast of it. Again, these modules definitely implement the correct hook_mail call, so they will be rerouted.

Emails were again sent today, 8 in total, two to each of the users with the uid's 7272, 7689, 4214 and 2365 and one to uid 7804. I have boounced copies of these emails to Jim.

  1. I also reckon DEV does not need cron running at all. Test should IMHO as it needs to behave like

OK, I'll change this.

Finally, I reckon certain modules do not have a place on TEST or DEV, unless they're being actively developed for. These include the Messaging and Notifications modules mentioned before, plus the feed importer and mailchimp integration. I also think that these sites should be put into maintenance mode when not in use. What do we think? A quick SQL script to turn these off should be part of any automated or manual sync with LIVE process IMO.

OK, that sounds good, I can write a script which inserts the live data and resetts the email addresses, what commands are needed to do the other things?

comment:13 Changed 6 years ago by ed

i intend to go into dev and cancel these users subs so they don't get this spam:
7272, 7689, 4214 and 2365 and one to uid 7804

is taht the right thing to do?

comment:14 Changed 6 years ago by chris

The users shouldn't be getting any emails currently, they are all being sent to the list because I changed the email addresses for users to the list address.

The test server has just now sent a load to the list as well...

comment:15 Changed 6 years ago by jim

ED:

Don't bother... it's an issue that's already resolved and your fix would need re-doing for every user once we updated TEST or DEV anyway... Not worth the hassle.

Chris:

  1. Drupal best practice for the cookie domain thing changed in D6.17... LIVE uses the preceeding dot approach and it fixed a number of issues. DEV and TEST should follow where possible - and for now the certificate is the least of our worries.

5 & 6. Then the DEV & TEST servers are behaving normally, as it appears is the reroute email module, though that's impossible to test since all emails now are the same as the reroute address which means it won't change them.

  1. Ta.

The SQL to disable these modules is:

update system
set `status` = 0
where `name` like '%messag%'
or `name` like '%notif%'
or `name` like '%mailchimp%';

comment:16 Changed 6 years ago by chris

  1. Drupal best practice for the cookie domain thing changed in D6.17... LIVE uses the preceeding dot approach and it fixed a number of issues. DEV and TEST should follow where possible - and for now the certificate is the least of our worries.

OK, but it would be good to sort the certs/domainname issue out -- if people use the wrong domain the email reminder function doesn't work, and I expect that this was the cause of Ed's login problems.

5 & 6. Then the DEV & TEST servers are behaving normally, as it appears is the reroute email module, though that's impossible to test since all emails now are the same as the reroute address which means it won't change them.

I have created a couple of alias for the sites, which will send email to the list:

transition-dev@…
transition-test@…

So if we set all the email addresses, apart from the developers ones, to these addresses as we update the database with a new import from live and any emails are sent we will know a bit more about how they were triggered.

  1. Ta.

The SQL to disable these modules is:

update system
set `status` = 0
where `name` like '%messag%'
or `name` like '%notif%'
or `name` like '%mailchimp%';

Great, I have run that query on both the dev and test databases and I'll incorporate this in the script to automate the update of the database.

comment:17 Changed 6 years ago by chris

I'll incorporate this in the script to automate the update of the database.

This has been done, see DevelopmentServer#live2dev and attachment:wiki:DevelopmentServer:live2dev.txt also the script sets the email addresses as suggested above in comment:ticket:136:16

comment:18 Changed 6 years ago by chris

  • Status changed from reopened to closed
  • Resolution set to fixed

I think this is issue is sorted now, the script for automating the updating of the test and dev databases is being dealt with on ticket:124

comment:19 Changed 6 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.15
  • Status changed from closed to reopened
  • Resolution fixed deleted
  • Total Hours changed from 0.0 to 0.15

Sorry to reopen this ticket, I just requested a new password via https://dev.transitionnetwork.org.webarch.net/user/password and the email came my address rather than transition-dev@… so it appears that the reroute email module isn't working even though it's there, /web/dev.transitionnetwork.org.webarch.net/www/sites/all/modules/reroute_email and enabled in /web/dev.transitionnetwork.org.webarch.net/www/sites/default/settings.php:

$conf['reroute_email_enable'] = 1;
$conf['reroute_email_address'] = "transition-dev@email-lists.org";

However the SQL query for disabling various modules which send users emails (see ticket:136#comment:15) has ensured that the site isn't sending users email updates:

mysql> select filename,name,status from system where `name` like '%messag%' or `name` like '%notif%' or `name` like '%mailchimp%';
+------------------------------------------------------------------------------------------------+-----------------------------+--------+
| filename                                                                                       | name                        | status |
+------------------------------------------------------------------------------------------------+-----------------------------+--------+
| sites/all/modules/messaging/messaging.module                                                   | messaging                   |      0 | 
| sites/all/modules/messaging/messaging_debug/messaging_debug.module                             | messaging_debug             |      0 | 
| sites/all/modules/messaging/messaging_mail/messaging_mail.module                               | messaging_mail              |      0 | 
| sites/all/modules/messaging/messaging_mime_mail/messaging_mime_mail.module                     | messaging_mime_mail         |      0 | 
| sites/all/modules/messaging/messaging_phpmailer/messaging_phpmailer.module                     | messaging_phpmailer         |      0 | 
| sites/all/modules/messaging/messaging_privatemsg/messaging_privatemsg.module                   | messaging_privatemsg        |      0 | 
| sites/all/modules/messaging/messaging_simple/messaging_simple.module                           | messaging_simple            |      0 | 
| sites/all/modules/messaging/messaging_sms/messaging_sms.module                                 | messaging_sms               |      0 | 
| sites/all/modules/messaging/messaging_twitter/messaging_twitter.module                         | messaging_twitter           |      0 | 
| sites/all/modules/messaging/messaging_xmpp/messaging_xmpp.module                               | messaging_xmpp              |      0 | 
| sites/all/modules/notifications/notifications.module                                           | notifications               |      0 | 
| sites/all/modules/notifications/notifications_autosubscribe/notifications_autosubscribe.module | notifications_autosubscribe |      0 | 
| sites/all/modules/notifications/notifications_content/notifications_content.module             | notifications_content       |      0 | 
| sites/all/modules/notifications/notifications_lite/notifications_lite.module                   | notifications_lite          |      0 | 
| sites/all/modules/notifications/notifications_tags/notifications_tags.module                   | notifications_tags          |      0 | 
| sites/all/modules/notifications/notifications_ui/notifications_ui.module                       | notifications_ui            |      0 | 
| sites/all/modules/notifications/notifications_views/notifications_views.module                 | notifications_views         |      0 | 
| sites/all/modules/og/modules/og_notifications/og_notifications.module                          | og_notifications            |      0 | 
| sites/all/modules/privatemsg/pm_email_notify/pm_email_notify.module                            | pm_email_notify             |      0 | 
| sites/all/modules/mailchimp/mailchimp.module                                                   | mailchimp                   |      0 | 
+------------------------------------------------------------------------------------------------+-----------------------------+--------+
20 rows in set (0.00 sec)

Does anyone have any idea what the problem could be here?

comment:20 Changed 6 years ago by chris

However the SQL (see ticket:136#comment:15) does result in your user page,
https://dev.transitionnetwork.org.webarch.net/user displaying this error message:

    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_access_user' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'messaging_simple_access' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'mailchimp_user_edit_access' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_access_user' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_access_user' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_ui_access_page' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_ui_access_page' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_content_access' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_ui_access_page' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_ui_access_page' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'notifications_ui_access_user_add' was given in /web/dev.transitionnetwork.org.webarch.net/www/includes/menu.inc on line 452.

But I assume this is safe to ignore :-)

comment:21 Changed 6 years ago by chris

  • Status changed from reopened to closed
  • Resolution set to fixed

Closing -- even if the reroute email module isn't working the script to update the database sorts out all the email addresses, see wiki:DevelopmentServer#live2dev

comment:22 Changed 3 years ago by chris

  • Description modified (diff)

This issue has subsequently re-arrisen, at least twice:

Version 0, edited 3 years ago by chris (next)
Note: See TracTickets for help on using tickets.