Defect #5058

reminder mails are not sent when delivery_method is :async_smtp

Added by Go MAEDA over 7 years ago. Updated over 5 years ago.

Status:ClosedStart date:2010-03-12
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email notifications
Target version:1.4.0
Resolution:Fixed Affected version:0.9.3

Description

Reminder mails (rake redmine:send_reminders) are not sent when I set delivery_method in config/email.yml to :async_smtp.

version: Redmine 0.9.3.stable.3561


Related issues

Related to Redmine - Defect #5293: too slow ticket update in new version Closed 2010-04-12
Related to Redmine - Patch #613: Asynchronous email delivery Closed 2008-02-06
Duplicates Redmine - Defect #4228: no notification on issue creation by mail with redmine:e... Closed 2009-11-17

Associated revisions

Revision 9367
Added by Jean-Philippe Lang over 5 years ago

Fixed: reminder mails are not sent when delivery_method is :async_smtp (#5058).

History

#1 Updated by Jean-Philippe Lang over 7 years ago

  • Category set to Email notifications

#2 Updated by Jean-Philippe Lang over 7 years ago

Confirmed. The reason is that the process doesn't wait for the thread to finish. Adding a simple sleep works but it's not an elegant fix:

Index: app/models/mailer.rb
===================================================================
--- app/models/mailer.rb    (revision 3560)
+++ app/models/mailer.rb    (working copy)
@@ -323,6 +323,7 @@
     issues_by_assignee.each do |assignee, issues|
       deliver_reminder(assignee, issues, days) unless assignee.nil?
     end
+    sleep(10)
   end

   private

Maybe we'd better disable asynchronous sending when sending reminders.

#3 Updated by Go MAEDA over 7 years ago

Thanks for investigation.
How about this fix? Waiting for all threads to finish.

Index: app/models/mailer.rb
===================================================================
--- app/models/mailer.rb        (revision 3561)
+++ app/models/mailer.rb        (working copy)
@@ -309,6 +309,7 @@
     issues_by_assignee.each do |assignee, issues|
       deliver_reminder(assignee, issues, days) unless assignee.nil?
     end
+    Thread.list.each {|t| t.join(10) unless t == Thread.current}
   end

   private

#4 Updated by Etienne Massip over 6 years ago

  • Target version set to Candidate for next minor release

#5 Updated by Etienne Massip over 6 years ago

Go MAEDA wrote:

Thanks for investigation.
How about this fix? Waiting for all threads to finish.

[...]

Note 19 of #4228 states that it does not work :(

#6 Updated by Etienne Massip over 6 years ago

Would be nice if someone could test this change to lib/tasks/email.rake as proposed in #4228 :

task :receive_imap => :environment do
  Thread.abort_on_exception = true
  ...
  (existing code)
  ...
  threads.each {|t| t.join }
end

#7 Updated by Etienne Massip over 6 years ago

  • Status changed from New to Closed

Resolved by switching smtp delivery_method setting from async_smtp to smtp, which kind of a feature loss.

Would be great if someone could post a feedback of the change proposed in note-21.

#8 Updated by Etienne Massip over 6 years ago

  • Status changed from Closed to Reopened

Closed accidentally by closing duplicate.

#9 Updated by Serge ST over 6 years ago

Etienne, it didnt work for me.

#10 Updated by Robert Hailey about 6 years ago

I'm quite sure that this same issue has been causing emails to (sometimes) not be generated in response to email-stimulus (the process-incoming-emails rake task). Drop rate <30%.

#11 Updated by Mischa The Evil almost 6 years ago

I just stumbled upon this issue and finally found out why I never got the reminder emails feature working...

Etienne Massip wrote:

Would be nice if someone could test this change to lib/tasks/email.rake as proposed in #4228 :

[...]

Just tested it, but the same as Serge ST, it isn't working.

Note: I've added a reference to this issue on RedmineReminderEmails and EmailConfiguration.

#12 Updated by Jean-Philippe Lang over 5 years ago

  • Status changed from Reopened to Resolved
  • Target version changed from Candidate for next minor release to 1.4.0
  • Resolution set to Fixed

This should be fixed in r9367.

#13 Updated by Jean-Philippe Lang over 5 years ago

  • Status changed from Resolved to Closed

Merged in r9375.

Also available in: Atom PDF