requested to merge 4074-fix-stale-answer-client-timeout-with-clients-per-query into main
The number of clients per query is calculated using the pending fetch responses in the list. The dns_resolver_createfetch() function includes every item in the list when deciding whether the limit is reached (i.e. fctx->spilled is true). Then, when the limit is reached, there is another calculation in fctx_sendevents(), when deciding whether it is needed to increase the limit, but this time the TRYSTALE responses are not included in the calculation (because of early break from the loop), and because of that the limit is never increased.
A single client can have more than one associated response/event in the list (currently max. two), and calculating them as separate "clients" is unexpected. E.g. if 'stale-answer-enable' is enabled and 'stale-answer-client-timeout' is enabled and is larger than 0, then each client will have two events, which will effectively halve the clients-per-query limit.
Fix the dns_resolver_createfetch() function to calculate only the regular FETCHDONE responses/events.
Change the fctx_sendevents() function to also calculate only FETCHDONE responses/events. Currently, this second change doesn't have any impact, because the TRYSTALE events were already skipped, but having the same condition in both places will help prevent similar bugs in the future if a new type of response/event is ever added.
Closes #4074 (closed)