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

**URL:** https://meta.discourse.org/t/jobs-handledexceptionwrapper-wrapped-socketerror-getaddrinfo-name-or-service-not-known/42652
**Category:** Support
**Created:** [4월 16, 2016, 3:00오후 UTC](https://meta.discourse.org/t/jobs-handledexceptionwrapper-wrapped-socketerror-getaddrinfo-name-or-service-not-known/42652 "2016-04-16T15:00:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![markplindsay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markplindsay/32/121849_2.png) [@markplindsay](https://meta.discourse.org/u/markplindsay)
#### Post date: [4월 16, 2016, 3:00오후 UTC](https://meta.discourse.org/t/jobs-handledexceptionwrapper-wrapped-socketerror-getaddrinfo-name-or-service-not-known/42652/1 "2016-04-16T15:00:15Z")

</div>

So, emails are failing _en masse_ once again on my site.

 ![](https://global.discourse-cdn.com/meta/original/3X/5/3/53310f71270ab8e8ead4114d6105346acaee6eb1.png)

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](https://meta.discourse.org/t/conflicting-out-of-date-vs-up-to-date-statuses/41339) and I had originally thought these 2 problems were unrelated—but maybe that is not the case?

---

<div class="post-metadata">

### Author: ![markplindsay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markplindsay/32/121849_2.png) [@markplindsay](https://meta.discourse.org/u/markplindsay)
#### Post date: [4월 16, 2016, 4:30오후 UTC](https://meta.discourse.org/t/jobs-handledexceptionwrapper-wrapped-socketerror-getaddrinfo-name-or-service-not-known/42652/2 "2016-04-16T16:30:02Z")

</div>

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

Here is a backtrace from `GET /logs`:

```plaintext
/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'

```

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [4월 16, 2016, 6:22오후 UTC](https://meta.discourse.org/t/jobs-handledexceptionwrapper-wrapped-socketerror-getaddrinfo-name-or-service-not-known/42652/3 "2016-04-16T18:22:43Z")

</div>

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

In other words can you dig it?

```bash
dig smtpaddress.com

```

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [4월 16, 2016, 6:24오후 UTC](https://meta.discourse.org/t/jobs-handledexceptionwrapper-wrapped-socketerror-getaddrinfo-name-or-service-not-known/42652/4 "2016-04-16T18:24:53Z")

</div>

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

This might be helpful:

> [@Initial email failure. Job exception: getaddrinfo: Name or service not known](https://meta.discourse.org/t/initial-email-failure-job-exception-getaddrinfo-name-or-service-not-known/42301/2):
>
> Probably Discourse can’t figure out DNS for your \<mycompany\>.com. Set dns in DOCKER\_OPTS. You can point to Google DNS server as 8.8.8.8 or ask your IT about internal DNS server (probably you have one) Then restart docker. You can find the detailed steps by following the link.

---

<div class="post-metadata">

### Author: ![markplindsay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markplindsay/32/121849_2.png) [@markplindsay](https://meta.discourse.org/u/markplindsay)
#### Post date: [5월 1, 2016, 1:45오전 UTC](https://meta.discourse.org/t/jobs-handledexceptionwrapper-wrapped-socketerror-getaddrinfo-name-or-service-not-known/42652/5 "2016-05-01T01:45:43Z")

</div>

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](https://meta.discourse.org/t/conflicting-out-of-date-vs-up-to-date-statuses/41339) as a bonus!

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5월 1, 2016, 3:11오전 UTC](https://meta.discourse.org/t/jobs-handledexceptionwrapper-wrapped-socketerror-getaddrinfo-name-or-service-not-known/42652/6 "2016-05-01T03:11:53Z")

</div>


