Sending emails for issues that are auto-closed

Gerhard Killesreiter - February 9, 2009 - 10:46
Project:Project issue tracking
Version:6.x-1.x-dev
Component:Mail
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:6.x-1.0 blocker
Description

On the test site on the SUN I triggered cron.php and 105k mails were tried to get sent. Luckily I intervened and the last 20k were not actually sent.

Of the ones who got sent, there is one that is strange:

Issue status update for
http://localhost:8080/node/187480
Post a follow up:
http://localhost:8080/comment/reply/187480#comment-form

Project: Drupal
Version: 4.6.0
Component: user system
Category: support request
Priority: normal
Assigned to: Anonymous
-Status: fixed
+Status: closed
Updated by: System Message

While it makes sense that this issue got closed, it was never associated with Drupal 4.6. I wonder if we would have the same problem after the update.

#1

aclight - February 9, 2009 - 12:19

We also shouldn't be sending out emails when issues are automatically closed--at least we never have in the past.

#2

Gábor Hojtsy - February 13, 2009 - 07:40
Priority:normal» critical

Gerhard says this is important to look into before the upgrade, and he will look into it.

#3

Gerhard Killesreiter - February 13, 2009 - 10:01

I run cron.php on a testsite and apparently the mails are totally messed up:

From www-data@dosprint.org Fri Feb 13 09:47:59 2009
Return-Path:
X-Original-To: 13
Delivered-To: 13@dosprint.org
Received: by theming.dosprint.org (Postfix, from userid 33)
id C0A924A58C8D; Fri, 13 Feb 2009 09:22:14 +0000 (UTC)
To: Release@dosprint.org, critical@dosprint.org, bugs@dosprint.org,
for@dosprint.org, February@dosprint.org, 13@dosprint.org,
2009@dosprint.org
Subject:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8Bit
X-Mailer: Drupal
Errors-To: info@drupal.org
Sender: info@drupal.org
Reply-To: Array@dosprint.org
From: Array@dosprint.org
Message-Id: <20090213092214.C0A924A58C8D@theming.dosprint.org>
Date: Fri, 13 Feb 2009 09:22:14 +0000 (UTC)

Also, there is no body to the mail.

#4

mr.baileys - February 13, 2009 - 10:57

Since this happens on a cron run, I assume this is limited to digest & reminder mails only (or does this affect the "regular" mail notifications too?)

I rewrote part of the mail handling in #361651: Port project_issue to use the D6 drupal_mail() but only addressed project_issue/mail.inc. In hindsight the aforementioned issue should also have addressed the mail code in project_issue/cron.php.

#5

hunmonk - February 17, 2009 - 04:55
Status:active» needs review

here's a first stab at converting the digest and reminder stuff to the 6.x mail API -- totally untested. would be great if i could get a code review of this so i know i'm handling things appropriately. the reminder code is kind of convoluted, so instead of rewriting it i simply embraced it and stuffed the generated body code into a param ;)

also in the process of upgrading, i caught a performance enhancement: we were doing a ton of user_load()'s just to pull assigned names, so i integrated that into the queries instead.

AttachmentSize
project_issue_mail_digest_reminder_fixes.patch 9.49 KB

#6

Gábor Hojtsy - February 17, 2009 - 13:56
Project:Project issue tracking» Project Issue File Review
Version:6.x-1.x-dev» 6.x-1.x-dev
Component:Mail» Code

The mail sending code looks good. The original issue was however that they got sent at all. How did the patch affects that?

#7

Gábor Hojtsy - February 17, 2009 - 13:57
Project:Project Issue File Review» Project issue tracking
Version:6.x-1.x-dev» 6.x-1.x-dev
Component:Code» Mail

OMG, don't know how this recategorization happened, sorry.

#8

hunmonk - February 17, 2009 - 15:45

attached patch has been tested and produces the following output:

DIGEST:

To: chad@apartmentlines.com
Subject: Release critical bugs for February 17, 2009
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8Bit
X-Mailer: Drupal
Errors-To: a@example.com
Return-Path: a@example.com
Sender: a@example.com
Reply-To: chad@apartmentlines.com
From: chad@apartmentlines.com
Date: Tue, 17 Feb 2009 10:17:31 -0500
List-Id: Drupal <localhost-project-issues-digest>
List-Archive: <http://localhost/drupal/project6/project/issues?priorities=1>

Drupal / bug reports

Incassum Persto Sino Vereor Scisco Ad Verto Imputo Premo Pecus Abbas Te Quae 
Probo
   assigned: swucrukucrih
   age: 1 year 4 weeks
   url: http://localhost/drupal/project6/node/129

REMINDER:

To: swucrukucrih@localhost
Subject: Your submitted bugs for February 17, 2009
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8Bit
X-Mailer: Drupal
Errors-To: a@example.com
Return-Path: a@example.com
Sender: a@example.com
Reply-To: a@example.com
From: a@example.com
Date: Tue, 17 Feb 2009 10:39:35 -0500
List-Id: Drupal <project-reminder-localhost>
List-Archive: <http://localhost/drupal/project6/project>

[ Drupal / Code ]=======================================================
Incassum Persto Sino Vereor Scisco Ad Verto Imputo Premo Pecus Abbas Te Quae 
Probo
   assigned: swucrukucrih
   state: active
   age: 1 year 4 weeks
   url: http://localhost/drupal/project6/node/129

this all looks ok to me. can i get an amen?

AttachmentSize
project_issue_mail_digest_reminder_fixes.patch 9.76 KB

#9

Gábor Hojtsy - February 17, 2009 - 15:48

Looks all good!

#10

dww - February 17, 2009 - 18:21

@aclight, hunmonk, et al: Generating emails during auto-close has been happening in D5 for a while. I'm not sure if we ever had code specifically to prevent it. AFAIK, the only way you don't get them in D5 (if you subscribe at all), is via the settings at node/N/edit/issues -- if you use "Issues e-mail address:" and select some checkboxes for which states you want email for. So long as you select something in there, but don't select "closed", you won't see auto-close emails.

I just tested all this again on my local D5 test install, and that's definitely how it works. Yes, there are all sorts of problems and limitations with the current subscription functionality, but this is a red-herring in terms of the D6 upgrade and deployment on d.o tomorrow. The main thing is fixing the bugs with the D6 mail API which hunmonk's patch is supposed to fix. I'll review that closely next, stay tuned.

#11

Gábor Hojtsy - February 17, 2009 - 18:25

Ok, then we might have perceived having some functionality which was not there. No worries with that then.

#12

aclight - February 17, 2009 - 19:18

@dww: As far as I can recall I have never received an email when an issue was automatically closed. I subscribe to all issues on all the project* queues and my issues for pretty much all other projects, so certainly many issues I've been subscribed to were automatically closed yet I got no email message.

It sounds to me like you're talking about subscribing to issues via node/N/edit/issues, not via the standard subscriptions page, which is how I have subscribed to issues.

On the same day Gerhard posted this issue I also got an email for one issue and the email was informing me that the issue had just been automatically closed. I haven't gotten one since, so if sending of issues on d6.drupal.org is enabled and cron is running it seems that there must not be a problem. However if cron has not been running there could be a problem as it would be an (annoying, IMHO) change in behavior to start getting emails for issues as they are automatically closed.

#13

Gábor Hojtsy - February 17, 2009 - 19:34

http://drupal.org/node/367162 just got closed automatically half an hour ago. I am subscribed via adding a (useful :) comment, but I did not get an email, so this just proved as a test case of people not getting email on closed issues.

#14

dww - February 17, 2009 - 19:57

@Gabor: You're "subscribed" via the infrastructure email list, right?

Behold:
http://drupal.org/node/107028/edit/issues

The fact you got no email is exactly the case I described in #10.

#15

dww - February 17, 2009 - 20:04

Oh, hrm, I guess not:

mysql> select * from project_subscriptions where nid = 107028 AND uid = 4166;
+--------+------+-------+
| nid    | uid  | level |
+--------+------+-------+
| 107028 | 4166 |     2 |
+--------+------+-------+
1 row in set (0.01 sec)

Weird. ;)

#16

dww - February 17, 2009 - 20:25

This issue is completely baffling to me. I've tested locally, on both D5 and D6, and I get the emails for autoclose if I use "normal" subscription via project/issues/subscribe-mail. There are no locally applied patches on d.o to project_issue that have anything to do with this, yet it seems like auto-close doesn't generate emails for regular subscriptions there. With d6.d.o currently down, I'm having trouble testing this to see what's actually happening there...

#17

hunmonk - February 18, 2009 - 03:40

with the upgrade lingering tomorrow, how do we proceed here?

i'd like to commit the patch in #8 to resolve the digest/reminder issue -- i'm feeling pretty confident that it fixes those issues from my local testing.

for the auto-close emails, we can:

  1. discuss and implement a full solution now.
  2. hack d.o locally to prevent the problem until we have a solution.
  3. just let the problem be a problem until we have a solution.

#1 seems unrealistic for tomorrow's deployment. i can live with #3, but i'm guessing a lot of others would have issues with it, so i'm recommending #2 unless somebody has a better idea. i think a fairly simple hack would be:

  1. stuff something into the comment array like $comment['no_mail'] = TRUE.
  2. look for this in the comment insert code and skip the issue emailing if it's found.

that hack would probably take about five minutes to write.

#18

Gábor Hojtsy - February 18, 2009 - 08:28
Status:needs review» reviewed & tested by the community

We sure need your patch to be committed first. I'm fine with #2 for the mail sending for now.

#19

dww - February 18, 2009 - 09:26
Status:reviewed & tested by the community» needs work

This patch always generates the weekly critical digest emails, even if there are no open critical issues, due to the way the logic for what to send is now totally separate from the logic for if it should be sent. I found a few other minor problems (wrong comment, stuff that wasn't clear that needed a comment, fixed a query by using db_placeholders() instead of directly stuffing variables into SQL (no, it's not SQL injection, but it's still clumsy and more fragile/risky as the code changes). I'm re-rolling now...

#20

dww - February 18, 2009 - 10:04
Title:Bug with sending mails» Sending emails for issues that are auto-closed?
Status:needs work» active

http://drupal.org/cvs?commit=172528 to HEAD fixes everything from #8 that I pointed out in #19.

Setting this back to active for the remaining topic of either fixing or hacking something about auto-close emails for the upgrade. We should test it on d6.d.o to see if it's actually trying to send them or not as the first step before anyone tries to write any code for this. I hope someone else can pick up that torch, I've got other critical issues to deal with and I really need sleep...

#21

hunmonk - February 18, 2009 - 18:28

http://drupal.org/cvs?commit=172599 handles this issue temporarily. we'll need a better long-term fix.

#22

dww - February 18, 2009 - 19:01
Title:Sending emails for issues that are auto-closed?» Sending emails for issues that are auto-closed
Category:bug report» task
Priority:critical» normal

#23

aclight - April 26, 2009 - 16:10

Adding 6.x-1.0 blocker term based on the commit message for http://drupal.org/cvs?commit=172599

#24

marcp - October 6, 2009 - 22:41

Subscribing. I'm trying to figure out what the real issue is here. I haven't been receiving email for issues that are auto-closed on drupal.org -- does that mean this is fixed, not-fixed, or hacked and needs a better fix?

#25

dww - October 7, 2009 - 00:14

I'm honestly not sure. ;) I haven't tried to reproduce this off *.d.o. Do you have a project* test site that sends email where you could see how it's currently behaving? That'd help narrow the scope of this issue. Thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.