Jobs::HandledExceptionWrapper: Wrapped SocketError: getaddrinfo: Name or service not known


#1

So, emails are failing en masse once again on my site.

This situation happened once before (in January), and restarting Discourse “fixed” it. But due to the very nature of the problem, there’s no good way to stay informed about whether there is a problem or not. In this episode, emails have not been sent since March 28, which is not great.

After some Googling, this appears to be a Ruby or a Ruby->Linux issue. However, my expertise is not with Ruby and so I don’t feel optimistic about digging into this one on my own.

Does anyone have a quick fix or at least some things to try? Thanks in advance.

P.S. I am still experiencing another Discourse bug and I had originally thought these 2 problems were unrelated—but maybe that is not the case?


#2

Just stopped and started Discourse and it is still unable to send email.

Here is a backtrace from GET /logs:

/usr/local/lib/ruby/2.0.0/net/smtp.rb:541:in `initialize'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:541:in `open'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:541:in `tcp_socket'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:551:in `block in do_start'
/usr/local/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:550:in `do_start'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:520:in `start'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:2141:in `do_delivery'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:236:in `block in deliver'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5/lib/action_mailer/base.rb:543:in `block in deliver_mail'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5/lib/action_mailer/base.rb:541:in `deliver_mail'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:236:in `deliver'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
/var/www/discourse/lib/email/sender.rb:131:in `send'
/var/www/discourse/app/jobs/regular/user_email.rb:69:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

(Rafael dos Santos Silva) #3

Do your box can resolve the DNS of the your stmp address?

In other words can you dig it?

dig smtpaddress.com

Conflicting "out of date" vs "up to date" statuses
(Erick Guan) #4

It’s the third DNS problem report in this week… :pokerface:

This might be helpful:


#5

Hi @Falco + @fantasticfears. Thanks a lot for your responses. I got email working again after a little effort today.

Adding the --dns options in /etc/default/docker and restarting docker with sudo service docker restart did work. I was able to open a /bin/bash inside the Discourse container and execute ping smtp.mandrillapp.com successfully. However, I was not able to send a test email within the Discourse web UI.

The next thing I tried was adding the same --dns options to docker_args inside my app.yml. I also added 8.8.8.8 and 8.8.4.4 to /etc/resolv.conf inside the Discourse container as my nameservers. (There were some Linode nameservers in there. I remembered that I followed some Linode-specific instructions when installing Docker in the first place. So, I likely have a nonstandard Docker install…this may be the root of my problems.) After making those changes, I executed /var/discourse/launcher rebuild app on my host.

After Discourse came back up, I was able to send the test email successfully. This also upgraded my Discourse install, solving my other problem as a bonus!

Thanks again for your replies, you definitely got me on the right track.


(Jeff Atwood) #6