Archive Index This month's Index

Subject: ares_callback() not received in some cases

ares_callback() not received in some cases

From: Luong, David <David.Luong_at_interoptechnologies.com>
Date: Thu, 20 Feb 2020 13:23:37 -0500

Hi.

Iím doing testing with c-ares 1.15 but encountered some unexpected results. I've made the same single-question query for all scenarios below.

Channel is initialized with:

    struct ares_options options;
    int optmask = 0;

    optmask |= ARES_OPT_SERVERS;
    optmask |= ARES_OPT_TIMEOUT;
    optmask |= ARES_OPT_TRIES;
    options.flags = ARES_FLAG_NOCHECKRESP;
    options.servers = NULL;
    options.nservers = 0;
    options.timeout = 5;
    options.tries = 1;

Scenario 1:

One name server was added to channel.

Name server is reachable and responded. ares_callback() is received with status ARES_SUCCESS.

Scenario 2:

One name server was added to channel.

Name server is reachable but does not respond: ares_callback() is received with status ARES_ECONNREFUSED.

Scenario 3:

One name server was added to channel.

Name server is not reachable. ares_callback() is never received.

Scenario 4:

Two name server were added to channel. First server is reachable but does not respond. Second server is reachable and can respond.

ares_callback() is never received.

It seems that once it has to try the second server, the query is never completed or time out.

Question:
Are these expected behavior? I'm expecting ares_callback() to happen in all cases with different statuses.

Regards,
David.
Received on 2020-02-20