summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-07-26 16:43:44 -0700
committerDavid Lamparter <equinox@opensourcerouting.org>2024-10-17 13:58:57 +0200
commite95fbc1d8cd8c1ec51c8b7fafd2341fdf0d299e9 (patch)
tree0f721cf7ae687104820d3ee6a3ee8f04e9a296c4
parentb7420c46defaa4209755346221e57d610bfdda3e (diff)
lib: zlog stays running on shutdown
No `zlog_fini()`, please. Getting log messages until the end is more important than leaking memory allocated for zlog targets. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--lib/libfrr.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c
index f2247a48e5..00ee57d8aa 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -1269,7 +1269,21 @@ void frr_fini(void)
event_master_free(master);
master = NULL;
zlog_tls_buffer_fini();
- zlog_fini();
+
+ if (0) {
+ /* this is intentionally disabled. zlog remains running until
+ * exit(), so even the very last item done during shutdown can
+ * have its zlog() messages written out.
+ *
+ * Yes this causes memory leaks. They are explicitly marked
+ * with DEFINE_MGROUP_ACTIVEATEXIT, which is only used for
+ * log target memory allocations, and excluded from leak
+ * reporting at shutdown. This is strongly preferable over
+ * just discarding error messages at shutdown.
+ */
+ zlog_fini();
+ }
+
/* frrmod_init -> nothing needed / hooks */
rcu_shutdown();