markplindsay reported a critical issue where emails failed to send in bulk, resulting in a SocketError: getaddrinfo: Name or service not known exception. Despite restarting the Discourse application, the problem persisted, as shown in the provided backtrace markplindsay. Falco suggested checking if the server could resolve the SMTP address via DNS using dig, while fantasticfears noted this was a recurring DNS issue and linked to a similar resolved thread. markplindsay confirmed that the root cause was a non-standard Docker installation lacking proper DNS configuration. The issue was resolved by adding --dns options to the Docker configuration and docker_args in app.yml, and manually setting nameservers to 8.8.8.8 and 8.8.4.4 inside the container. After rebuilding the app, email functionality was restored, and the update incidentally resolved a separate bug regarding conflicting update statuses.
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?
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.