Skip to content

Admin daemon: don't silently drop UDP-forwarded log lines it cannot write - #487

Open
SkrawlCO wants to merge 1 commit into
awehttam:claudesbbsfrom
SkrawlCO:upstream/up-026-admin-daemon-udp-log-fallback
Open

SkrawlCO wants to merge 1 commit into
awehttam:claudesbbsfrom
SkrawlCO:upstream/up-026-admin-daemon-udp-log-fallback

Conversation

@SkrawlCO

@SkrawlCO SkrawlCO commented Oct 5, 2026

Copy link
Copy Markdown

TITLE: Admin daemon: don't silently drop UDP-forwarded log lines it cannot write

Problem

When a process cannot write its own log file, Logger::log() forwards the line to the admin daemon over UDP, and the daemon appends it to the same target with @file_put_contents(). The return value is ignored. When the daemon cannot write that file either (for example it is owned by a different user than the daemon runs as), the line is lost with no trace anywhere.

Impact

Detailed traces, such as BinkP poll session logs written by processes the daemon spawns, disappear exactly when a file-ownership problem exists. That is the moment they are needed to diagnose it.

Repair

AdminDaemonServer::writeLogLineOrWarn() checks the write. On failure it logs a warning through the daemon's own logger with the target file name, sender pid, and the lost line. It skips the warning when the failing target is admin_daemon.log itself, to avoid recursion.

Proof

tests/Unit/AdminDaemonUdpLogFallbackTest.php forces a portable write failure by pointing the target at a directory. It has 4 tests: failure warns with the lost line, success writes normally, the self-target guard holds, and the line is written verbatim. It errors on the current branch (3 errors) and passes with the change. The rest of tests/Unit is unchanged.

…rite

The daemon appended UDP-forwarded log lines with @file_put_contents()
and ignored failures, so when the target file was not writable by the
daemon either, the line vanished without trace.

Check the write and, on failure, record the lost line through the
daemon's own logger (except for admin_daemon.log itself).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant