Subject: Re: handling socket errors

Re: handling socket errors

From: Pawel Veselov via c-ares <c-ares_at_cool.haxx.se>
Date: Thu, 31 Aug 2017 19:49:31 +0200

Bump?

On Sat, May 20, 2017 at 12:23 AM, Pawel Veselov <pawel.veselov_at_gmail.com>
wrote:

> Hello.
>
> One other thing that I don't quite understand - what should I do when I
> detect error conditions on any of the c-ares sockets? I.e. when the FD
> becomes exceptional in select(), or when POLL_ERR event is returned.

I'm running into this problem now - I get a poll error on socket controlled
by ares, and I'm clueless what to do with it.

I don't see any code in the library that would clear the error condition
(with getsockopt), nor on how do I tell the library that a descriptor is
bad
and should be abandoned.

I assume there should be a way to tell the library about that, and for any
pending requests, the (previously registered) callback will be executed
with a bad status.

this is what strace looks like for this, just in case.

sendto(7, "'\206\1\0\0\1\0\0\0\0\0\0\tlocalhost\0\0\34\0\1", 27,
MSG_NOSIGNAL, NULL, 0) = 27
epoll_ctl(5, EPOLL_CTL_ADD, 7, {EPOLLIN, {u32=3897652040,
u64=16764091172251595592}}) = 0
epoll_pwait(5, [{EPOLLIN, {u32=0, u64=0}}, {EPOLLERR, {u32=3897652040,
u64=16764091172251595592}}], 10, 3427, NULL, 8) = 2

I don't know what the error is (because I just had a $TODO in my code, not
knowing the answer and all :-D )
Received on 2017-08-31