Merge branch '4044-nslookup-reports-timeout-if-input-lookup-is-delayed' into 'bind-9.18'

[9.18] Update the event loop's time after executing a task

See merge request isc-projects/bind9!7891
This commit is contained in:
Arаm Sаrgsyаn 2023-06-20 11:06:35 +00:00
commit 4b97081fca
3 changed files with 29 additions and 0 deletions

View file

@ -1,3 +1,6 @@
6200. [bug] Fix nslookup erroneously reporting a timeout when the
input is delayed. [GL #4044]
6198. [func] Remove the holes in the isc_result_t enum to compact
the isc_result tables. [GL #4149]

View file

@ -44,6 +44,22 @@ grep "1.2.3.4" nslookup.out${n} > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
# See [GL #4044]
n=$((n+1))
echo_i "Check A only lookup with a delayed stdin input ($n)"
ret=0
(sleep 6 && echo "server 10.53.0.1" && echo "a-only.example.net.") | $NSLOOKUP -port=${PORT} 2> nslookup.err${n} > nslookup.out${n} || ret=1
lines=$(wc -l < nslookup.err${n})
test $lines -eq 0 || ret=1
lines=$(grep -c "Server:" nslookup.out${n})
test $lines -eq 1 || ret=1
lines=$(grep -c a-only.example.net nslookup.out${n})
test $lines -eq 1 || ret=1
grep "1.2.3.4" nslookup.out${n} > /dev/null || ret=1
grep "timed out" nslookup.out${n} > /dev/null && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "Check AAAA only lookup ($n)"
ret=0

View file

@ -847,6 +847,16 @@ isc__nm_async_task(isc__networker_t *worker, isc__netievent_t *ev0) {
result = isc_task_run(ievent->task);
/*
* Tasks can block for a long time, especially when used by tools in
* interactive mode. Update the event loop's time to avoid unexpected
* errors when processing later events during the same callback.
* For example, newly started timers can fire too early, because the
* current time was stale. See the note about uv_update_time() in the
* https://docs.libuv.org/en/v1.x/timer.html#c.uv_timer_start page.
*/
uv_update_time(&worker->loop);
switch (result) {
case ISC_R_QUOTA:
isc_task_ready(ievent->task);