diff --git a/CHANGES b/CHANGES index 7a6c458cae..a4915f76e3 100644 --- a/CHANGES +++ b/CHANGES @@ -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] diff --git a/bin/tests/system/nslookup/tests.sh b/bin/tests/system/nslookup/tests.sh index 1978eb40f3..abde65c98f 100644 --- a/bin/tests/system/nslookup/tests.sh +++ b/bin/tests/system/nslookup/tests.sh @@ -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 diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 00a7945edb..b19d468820 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -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);