From a84cccecd6f473c026d12f8303396db26c3129b9 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Tue, 21 Nov 2023 15:32:53 +0100 Subject: [PATCH] MT#58722 don't execute timers on shutdown phase Change-Id: I5fe19a1e664df9aa8f17117950636a741244d382 (cherry picked from commit b50f17c377f5f0b7b22c46f5675d12d653c1945e) (cherry picked from commit 4cd4424928281dde2cbf68d27050d9f3a2229526) (cherry picked from commit 33fe3be90e500350499b70568804125fe2e564d7) (cherry picked from commit ee5415e0046f48b832a80a499b0eb6e477accf47) --- debian/patches/series | 1 + ...don-t-execute-timers-on-destroy_modu.patch | 80 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 debian/patches/upstream/core-timer_proc-don-t-execute-timers-on-destroy_modu.patch diff --git a/debian/patches/series b/debian/patches/series index ec8626d2d..b97b0a3c0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -41,6 +41,7 @@ sipwise/Revert-pua_dialoginfo-disable-publish-notifications-.patch ## upstream master upstream/permissions-don-t-remove-old-data-at-the-end-of-the-.patch upstream/permissions-trusted_cleanup_interval.patch +upstream/core-timer_proc-don-t-execute-timers-on-destroy_modu.patch ### relevant for upstream sipwise/pua_dialoginfo-refresh_pubruri_avps_flag.patch sipwise/pua_dialoginfo-local_identity_dlg_var.patch diff --git a/debian/patches/upstream/core-timer_proc-don-t-execute-timers-on-destroy_modu.patch b/debian/patches/upstream/core-timer_proc-don-t-execute-timers-on-destroy_modu.patch new file mode 100644 index 000000000..fe01dd27d --- /dev/null +++ b/debian/patches/upstream/core-timer_proc-don-t-execute-timers-on-destroy_modu.patch @@ -0,0 +1,80 @@ +From: Victor Seva +Date: Tue, 21 Nov 2023 15:30:03 +0100 +Subject: core: timer_proc don't execute timers on shutdown phase + +--- + src/core/timer_proc.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/src/core/timer_proc.c b/src/core/timer_proc.c +index d153c63..1071d3e 100644 +--- a/src/core/timer_proc.c ++++ b/src/core/timer_proc.c +@@ -29,6 +29,7 @@ + #include "pt.h" + #include "ut.h" + #include "mem/shm_mem.h" ++#include "sr_module.h" + + #include + +@@ -74,6 +75,9 @@ int fork_basic_timer(int child_id, char* desc, int make_sock, + /* child */ + if (cfg_child_init()) return -1; + for(;;){ ++ if(unlikely(ksr_shutdown_phase() != 0)) { ++ return 0; ++ } + sleep(interval); + cfg_update(); + f(get_ticks(), param); /* ticks in s for compatibility with old +@@ -95,6 +99,9 @@ int fork_basic_timer_w(int child_id, char* desc, int make_sock, + /* child */ + if (cfg_child_init()) return -1; + for(;;){ ++ if(unlikely(ksr_shutdown_phase() != 0)) { ++ return 0; ++ } + sleep(interval); + cfg_update(); + f(get_ticks(), worker, param); /* ticks in s for compatibility with old +@@ -134,6 +141,9 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock, + /* child */ + if (cfg_child_init()) return -1; + for(;;){ ++ if(unlikely(ksr_shutdown_phase() != 0)) { ++ return 0; ++ } + sleep_us(uinterval); + cfg_update(); + ts = get_ticks_raw(); +@@ -156,6 +166,9 @@ int fork_basic_utimer_w(int child_id, char* desc, int make_sock, + /* child */ + if (cfg_child_init()) return -1; + for(;;){ ++ if(unlikely(ksr_shutdown_phase() != 0)) { ++ return 0; ++ } + sleep_us(uinterval); + cfg_update(); + ts = get_ticks_raw(); +@@ -258,6 +271,9 @@ int fork_sync_timer(int child_id, char* desc, int make_sock, + ts2 = interval; + if (cfg_child_init()) return -1; + for(;;){ ++ if(unlikely(ksr_shutdown_phase() != 0)) { ++ return 0; ++ } + if (ts2>interval) + sleep_us(1000); /* 1 milisecond sleep to catch up */ + else +@@ -306,6 +322,9 @@ int fork_sync_utimer(int child_id, char* desc, int make_sock, + ts2 = uinterval; + if (cfg_child_init()) return -1; + for(;;){ ++ if(unlikely(ksr_shutdown_phase() != 0)) { ++ return 0; ++ } + if(ts2>uinterval) + sleep_us(1); + else