Reputation: 3021
My nodejs application connects to an external url and uses the response. The application works fine most of the time, but I am getting EAI_AGAIN occasionally.
error:{code:EAI_AGAIN, errno:EAI_AGAIN,syscall:getaddrinfo,hostname:**.com,host:***.com,port:443}
I went through some questions related to EAI_AGAIN. Did not solve my purpose. Saw that this error occurs when DNS name resolving fails.
My concerns are
1) When I checked the logs. There were many successful requests just before the failed request and also there were many successful requests just after the failed request. Why did it fail for only one request?
2) What could be the actual cause? I would like to know all the possibilities.
3) Can the reason be an issue on the external service to which we are connecting?
4) Will be great if anyone can help to recreate the issue.
Note: We are using docker containers. If this has anything to do.
Upvotes: 7
Views: 9474
Reputation: 3714
Background
Under the hood, the error is coming from the getaddrinfo
syscall. This triggers the OS to perform a DNS query 99% of the time. Looking at the man page for getaddrinfo
we see the following concerning the EAI_AGAIN error:
EAI_AGAIN The name server returned a temporary failure indication. Try again later.
This basically tells us that when we see this error, the DNS server (name server) gave us a bad response. It could be burdened somehow and either actively respond with an error or not respond at all.
Questions
Upvotes: 7