logging: address code-review feedback

- Fix a critical regression where startup errors emitted before
  geulog::configure() (bad --config path, unknown CLI flag, --version
  banner) were queued into the async deque with no running worker
  and silently dropped on exit(). detail::enqueue() now falls back to
  synchronous ::write() to stdout/stderr when the worker is inactive.
- Remove the dead TRUNK_DEBUG parse block in Reflector.cpp and the
  m_trunk_debug member in Reflector.h — all gates were already
  removed in Phase 1; only the (unread) parse remained.
- Replace the #TRUNK_DEBUG=0 comment in svxreflector.conf.in with a
  documented LOG= reference block.
- Restore the [host:port] peer identity on the ReflectorClient
  ENOTCONN debug line so sysops can still correlate failures.
- Revert sighup_handler and sigterm_handler to async-signal-safe
  ::write(STDERR_FILENO, ...) instead of calling the (mutex-taking,
  allocating) facade from signal context.
- Retag two MsgTrunk* diagnostic sites in ReflectorMsg.h from core
  to trunk to match the enclosing-class rule.
- Doc: note that argument expressions are evaluated at the call site
  before the shouldLog() gate runs, and reword the "never drops"
  claim to acknowledge rare short-write truncation.
This commit is contained in:
Audric committed 2026-04-18 21:02:42 +02:00
1 parent 9761c6147f
commit efa02459e9
9 files changed
+73 -30

No files matched your search

+19 -9
View File
@@ -759,32 +759,42 @@ static void sighup_handler(int signal)
{
if (logfile_name == 0)
{
geulog::info("core", "Ignoring SIGHUP");
static const char MSG[] = "Ignoring SIGHUP\n";
(void)::write(STDERR_FILENO, MSG, sizeof(MSG) - 1);
return;
}
geulog::info("core", "SIGHUP received");
static const char MSG[] = "SIGHUP received\n";
(void)::write(STDERR_FILENO, MSG, sizeof(MSG) - 1);
logwriter.reopenLogfile();
} /* sighup_handler */
static void sigterm_handler(int signal)
{
const char *signame = 0;
switch (signal)
{
case SIGTERM:
signame = "SIGTERM";
{
static const char MSG[] =
"NOTICE: SIGTERM received. Shutting down application...\n";
(void)::write(STDERR_FILENO, MSG, sizeof(MSG) - 1);
break;
}
case SIGINT:
signame = "SIGINT";
{
static const char MSG[] =
"NOTICE: SIGINT received. Shutting down application...\n";
(void)::write(STDERR_FILENO, MSG, sizeof(MSG) - 1);
break;
}
default:
signame = "Unknown signal";
{
static const char MSG[] =
"NOTICE: Unknown signal received. Shutting down application...\n";
(void)::write(STDERR_FILENO, MSG, sizeof(MSG) - 1);
break;
}
}
geulog::info("core", "NOTICE: ", signame,
" received. Shutting down application...");
Application::app().quit();
} /* sigterm_handler */