diff options
| author | Sri Mohana Singamsetty <srimohans@gmail.com> | 2022-02-25 08:05:45 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-25 08:05:45 -0800 |
| commit | 787bd3ba6c960a073b94d99764b12c687b32e45a (patch) | |
| tree | 597ebb5a7ff51609a0b7a444b9001ad122914169 | |
| parent | 41ff140670e1c1a0cfbea682000a1cfe3a0cc1a0 (diff) | |
| parent | e2eff5c3b13ee31ddc1b80d828ce12fba64f6a3b (diff) | |
Merge pull request #10655 from donaldsharp/timers_warning_when_large
lib: Add a Dev catch for when a timer is set for > 1 year
| -rw-r--r-- | lib/lib_errors.c | 6 | ||||
| -rw-r--r-- | lib/lib_errors.h | 1 | ||||
| -rw-r--r-- | lib/thread.c | 6 |
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/lib_errors.c b/lib/lib_errors.c index acc9a05c33..a658e4c295 100644 --- a/lib/lib_errors.c +++ b/lib/lib_errors.c @@ -69,6 +69,12 @@ static struct log_ref ferr_lib_warn[] = { .suggestion = "Gather log data and open an Issue", }, { + .code = EC_LIB_TIMER_TOO_LONG, + .title = "The Event subsystem has detected an internal timer that is scheduled to pop in greater than one year", + .description = "The Event subsystem has detected a timer being started that will pop in a timer that is greater than one year. This is a bug, please collect log data and open an issue.", + .suggestion = "Gather log data and open an Issue", + }, + { .code = EC_LIB_RMAP_RECURSION_LIMIT, .title = "Reached the Route-Map Recursion Limit", .description = "The Route-Map subsystem has detected a route-map depth of RMAP_RECURSION_LIMIT and has stopped processing", diff --git a/lib/lib_errors.h b/lib/lib_errors.h index 64ac6c1ceb..91f206f74a 100644 --- a/lib/lib_errors.h +++ b/lib/lib_errors.h @@ -48,6 +48,7 @@ enum lib_log_refs { EC_LIB_SLOW_THREAD_WALL, EC_LIB_STARVE_THREAD, EC_LIB_NO_THREAD, + EC_LIB_TIMER_TOO_LONG, EC_LIB_RMAP_RECURSION_LIMIT, EC_LIB_BACKUP_CONFIG, EC_LIB_VRF_LENGTH, diff --git a/lib/thread.c b/lib/thread.c index 58b8e206fa..bc3bfe89d4 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1052,6 +1052,12 @@ static void _thread_add_timer_timeval(const struct xref_threadsched *xref, if (thread_timer_list_first(&m->timer) == thread) AWAKEN(m); } +#define ONEYEAR2SEC (60 * 60 * 24 * 365) + if (time_relative->tv_sec > ONEYEAR2SEC) + flog_err( + EC_LIB_TIMER_TOO_LONG, + "Timer: %pTHD is created with an expiration that is greater than 1 year", + thread); } |
