From 271569b19411b81eaaa474def5a79d71e9bcc3d9 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Fri, 17 Jan 2025 13:53:44 +0100 Subject: [PATCH] Fixed: [Backend hangs when doing "process services restart" in the CLI](https://github.com/clicon/clixon-controller/issues/178) --- CHANGELOG.md | 1 + lib/src/clixon_log.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6628dc52..eb438ca3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Developers may need to change their code ### Corrected Bugs +* Fixed: [Backend hangs when doing "process services restart" in the CLI](https://github.com/clicon/clixon-controller/issues/178) * Fixed: [Autocli: error when empty YANG group and grouping-treeref=true](https://github.com/clicon/clixon/issues/579) * Fixed: [Mem error when more multiple uses on top level with multiple statements in grouping](https://github.com/clicon/clixon/issues/583) * Fixed: [Change CLICON_NETCONF_DUPLICATE_ALLOW to remove duplicates](https://github.com/clicon/clixon-controller/issues/160) diff --git a/lib/src/clixon_log.c b/lib/src/clixon_log.c index 8044fed2..3ebdd75a 100644 --- a/lib/src/clixon_log.c +++ b/lib/src/clixon_log.c @@ -340,8 +340,14 @@ clixon_log_str(int level, /* Remove trailing CR if any */ if (strlen(msg) && msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = '\0'; - if (_log_flags & CLIXON_LOG_SYSLOG) - syslog(LOG_MAKEPRI(LOG_USER, level), "%s", msg); // XXX this may block + if (_log_flags & CLIXON_LOG_SYSLOG){ + static int _recurse = 0; + /* avoid mutex if called recursively */ + if (_recurse++ == 0){ + syslog(LOG_MAKEPRI(LOG_USER, level), "%s", msg); + _recurse = 0; + } + } /* syslog makes own filtering, we do it here: * if normal (not debug) then filter loglevels >= debug */