简体   繁体   中英

Rails 4.1.6 Mailers Hanging

I just upgraded to rails 4.1.6 with ruby 2.1.2. None of my Mailers are working they are all hanging prior to, or perhaps during, rendering the templates. If I downgrade to 4.1.5 mailers work perfectly. From console If I break out of the hang using control-c this is the (important part) stack:

f = FooMailer.invite(FitnessClass.first, User.first, User.last)
FooMailer#invite: processed outbound mail in 94063.9ms
IRB::Abort: abort then interrupt!
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.6.1/lib/mail/field_list.rb:22:in `call'
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.6.1/lib/mail/field_list.rb:22:in `+'
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.6.1/lib/mail/field_list.rb:22:in `+'
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.6.1/lib/mail/field_list.rb:22:in `<<'
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.6.1/lib/mail/header.rb:178:in `[]='
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mail-2.6.1/lib/mail/message.rb:1309:in `[]='
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionmailer-4.1.6/lib/action_mailer/base.rb:786:in `block in mail'
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionmailer-4.1.6/lib/action_mailer/base.rb:786:in `each'
from /Users/derrek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/actionmailer-4.1.6/lib/action_mailer/base.rb:786:in `mail'
from /Users/derrek/git/foo/foo/app/mailers/foo_mailer.rb:18:in `invite'

Yep - it was an infinite loop in the Mail gem. This has been fixed by this commit and will be ok in version 2.6.2. Until then:

gem 'mail', github: "mikel/mail"

I found the problem to be in the Mail gem. If I downgrade to 2.5.4 everything works again. I didn't trace exactly what was going on but in version 2.6.1 the code was getting stuck in an infinite loop. I'd say this is more a work a round than a fix, but it's better than being stuck.

gem 'mail', '2.5.4'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM