vlib: reset stop_timer_handle on expired processes 60/38660/2 stable/2302
authorMatthew Smith <mgsmith@netgate.com>
Tue, 4 Apr 2023 19:27:55 +0000 (19:27 +0000)
committerDave Wallace <dwallacelf@gmail.com>
Wed, 13 Sep 2023 17:02:00 +0000 (17:02 +0000)
commit0dfaadec8cb6a512f3ce81946b9d39aa8cb1d9f5
tree1f4c8dae87c379e07a5ce817f7914675186cb0cb
parent3be288f0d9214ed25303bb620b07b09e0a26f1e2
vlib: reset stop_timer_handle on expired processes

Type: fix

The main loop populates a vector of suspended process nodes to dispatch
by calling TW (tw_timer_expire_timers_vec), which identifies expired
timers and appends the user handle for each one to the vector.

Subsequently, the vector is iterated and the process node corresponding
to each handle is dispatched. The vast majority of the time, the process
node will end up suspending itself again to wait for a new timer or
event.

Given a process node A whose timer has expired, between the point when
the timer expired and the point when A is dispatched and suspends itself
again, its stop_timer_handle contains a stale value.

If another process node B is dispatched before A is dispatched, it may
end up using the timer ID that A formerly used. If another process node
C is dispatched after B and before A and calls
vlib_process_signal_event() to signal A, the timer started by B can be
deleted by vlib_process_signal_event_helper().

After getting the vector of process node IDs for expired timers, reset
the stop_timer_handle on each of those nodes.

Change-Id: I266da438e76e1fc356016da0b9b4941efac1c28a
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
(cherry picked from commit 9aa4ac55b0a205e333e567f87c3cc9379af2363c)
src/vlib/main.c