Archive Index This month's Index

Subject: Re: Hitting EAGAIN in ares_process.c:787

Re: Hitting EAGAIN in ares_process.c:787

From: Fred Huang <>
Date: Wed, 28 Aug 2013 22:15:43 +0800

the UDP socket option should be using non-block mode which need to not take
EAGAIN return value for read/write as an error. it means 'no socket buffer
for now, please try again later' for write UDP, or 'no packet received yet
in the buffer' for read.
solution: for write, please set socket option to increase receive buffer to
a larger value (such as 1 MB), for read, please return normally and retry
the receiving next time.

2013/8/27 Edwin Mons <>

> Hi,
> We're using C-ARES to do DNS resolving in our products. During high
> network load, we hit an issue in ares_process.c:785 where writing to a UDP
> socket on Linux fails with an EAGAIN error. The FIXME comment in the code
> suggests this could happen, but it is as of yet left unresolved.
> Part of the problem is that if an EAGAIN hits, the code immediately
> switches to the next server, increases the try_again counter and
> immediately fires off a new request. If the system is particularly busy,
> EAGAIN will likely happen for subsequent writes, resulting in many failed
> lookups.
> Is anyone already looking into this?
> Edwin
Received on 2013-08-28