aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2025-01-27 19:49:07 +0000
committerBenoit Ganne <bganne@cisco.com>2025-02-12 13:48:57 +0000
commitb41167a0bbbd3d81a2dd8e756d938f89b5ace5f3 (patch)
treee6991e2937c9138e96dbff7f1bb308bbed117be0 /src
parent8e641af0459ec3aeed2b81b95d263440e76b4c47 (diff)
vrrp: force sleeps between timer events
Adding a virtual MAC to some NICs can take a significant amount of time. If a lot of VRs enter the master state around the same time, the process node can stay active for a very long time processing all of the transitions. Try to force a 10 us sleep between processing events to ensure that the process node does not prevent API messages and RPCs from being handled for an extended period. Type: improvement Signed-off-by: Matthew Smith <mgsmith@netgate.com> Change-Id: I400a7d395b4c0fec371f70d359e9d184ae79645e
Diffstat (limited to 'src')
-rw-r--r--src/plugins/vrrp/vrrp_periodic.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/vrrp/vrrp_periodic.c b/src/plugins/vrrp/vrrp_periodic.c
index 5f9d7ae938e..e3a374a112d 100644
--- a/src/plugins/vrrp/vrrp_periodic.c
+++ b/src/plugins/vrrp/vrrp_periodic.c
@@ -187,7 +187,19 @@ vrrp_periodic_process (vlib_main_t * vm,
timer = pool_elt_at_index (pm->vr_timers, next_timer);
timeout = timer->expire_time - now;
- vlib_process_wait_for_event_or_clock (vm, timeout);
+ /*
+ * Adding a virtual MAC to some NICs can take a significant amount
+ * of time (~1s). If a lot of VRs enter the master state around the
+ * same time, the process node can stay active for a very long time
+ * processing all of the transitions.
+ *
+ * Try to force a 10us sleep between processing events to ensure
+ * that the process node does not prevent API messages and RPCs
+ * from being handled for an extended period. This prevents
+ * vlib_process_wait_for_event_or_clock() from returning
+ * immediately.
+ */
+ vlib_process_wait_for_event_or_clock (vm, clib_max (timeout, 10e-6));
}
event_type = vlib_process_get_events (vm, (uword **) & event_data);