Subject: tcp connection closed although initialized with ARES_FLAG_STAYOPEN

tcp connection closed although initialized with ARES_FLAG_STAYOPEN

From: Anlin Zhang <anlin.zhang_at_gmail.com>
Date: Mon, 5 Nov 2007 17:52:28 -0800

Hi,

I did:
opts.flags = ARES_FLAG_USEVC | ARES_FLAG_STAYOPEN;
...
ares_init_options(&myChannelPtr, &opts, optMask);

After first successful query, program sleeps for 60 seconds and do another
query. The second query fails and get Status 4.

I found the tcp connection is closed 30 seconds after first query, and the
second query doesn't detect this and cannot re-open tcp connection.

Does ARES_FLAG_STAYOPEN means always keep tcp connections? or there is still
a idle timeout? Or is the DNS server close the connection? Why client cannot
detect this and re-open connection?

Our current workaround is not to ARES_FLAG_USEVC but not use
ARES_FLAG_STAYOPEN.

Thanks,
Anlin.
Received on 2007-11-06