Q:

getaddrinfo Issues

I am currently playing around with writing my own HTTP proxy. I have the code working but I attempted to stress test it with ApacheBench and found that every now and again I get a message such as follows: 
"getaddrinfo: nodename nor servname provided, or not known for host en.wikipedia.org service 80"
I can not work out why this function call should fail on where the hostname and port are passed.
I have looked online for different ways to solve this and have found nothing useful.
Does anyone have any ideas?
edit
Solved this problem by implementing a DNS caching system within my application.

A:

Maybe something in your resolution stack couldn't take the volume of queries you were making?
You'd have to start with /etc/nsswitch.conf, and see how queries are resolved on your system. At some point, you'll eventually get to your local DNS cache, which may also time out if it has too many queries at once.
You may find that you need to run a DNS cache either in your proxy (Squid does, for example) or locally with e.g., lwresd.

