]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Update the event loop's time after executing a task
authorAram Sargsyan <aram@isc.org>
Fri, 5 May 2023 10:46:37 +0000 (10:46 +0000)
committerAram Sargsyan <aram@isc.org>
Tue, 20 Jun 2023 10:21:54 +0000 (10:21 +0000)
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.

lib/isc/netmgr/netmgr.c

index 00a7945edb792b017db4e60479dfba90c6de3b0b..b19d468820a3b3d2d1106a1cee17c6be380a7d9d 100644 (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);