Skip to content

Fixes from the 2026-11 audit, part 5: BackgroundSender and syslog - #373

Merged
FreeAndNil merged 6 commits into
masterfrom
Feature/2026-11-audit-chain-d
Nov 22, 2026
Merged

FreeAndNil merged 6 commits into
masterfrom
Feature/2026-11-audit-chain-d

Conversation

@FreeAndNil

Copy link
Copy Markdown
Contributor

- Dispose after Close no longer repeats it, a grown total is reported again
- RecordingSink replaces the shared recordings in BackgroundSenderTest
- AGENTS.md allows one fixture instance per test
- ANT-2026-M13HDM0A
- shared partial for the background sending of the three appenders
- sender reports name a message instead of a logging event
@FreeAndNil
FreeAndNil force-pushed the Feature/2026-11-audit-chain-d branch from 8704839 to ed950ef Compare November 22, 2026 18:03
- ANT-2026-C2Q2AQZL
- the error may belong to the datagram before, on Linux
- docs on maxDatagramSize behind a router with a smaller MTU
- ANT-2026-6O92ZO65
- a value set after ActivateOptions escapes instead of keeping the line breaks
- ANT-2026-1YRNCBP9
- VT, FF, FS, GS, RS, NEL, U+2028 and U+2029 as \uXXXX in Escape and Split
… caller

- CallerArgumentExpression, hidden from IntelliSense, signature breaks on purpose
- all 32 call sites drop the name
- ValidateIndex reports "index" instead of "i"
@FreeAndNil
FreeAndNil marked this pull request as ready for review November 22, 2026 19:01
@FreeAndNil FreeAndNil added this to the 3.6.1 milestone Nov 22, 2026

@gdziadkiewicz gdziadkiewicz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@FreeAndNil
FreeAndNil merged commit de8e20b into master Nov 22, 2026
3 checks passed
@FreeAndNil
FreeAndNil deleted the Feature/2026-11-audit-chain-d branch November 22, 2026 20:11
@FreeAndNil

FreeAndNil commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Implementation plan for #373, kept here for the record. Written up to describe the change as it stands on the branch.

Plan

Fixes from the 2026-11 audit, part 5: BackgroundSender and syslog

Context

The same scan as #355 reported, among the lows, problems in the background senders and the syslog
appenders: a full send queue makes every logging call wait the full timeout, RemoteSyslogAppender
loses a record after an ICMP error, and LocalSyslogAppender lets an undefined NewLineHandling
and line breaks other than CR and LF through raw. The close summary reported twice turned up while
fixing them. Three issues: #370 (the background sender), #371 (the ICMP error), #372 (newline
handling).

Constraints that shape the design

  • BackgroundSender<T> is shared by TelnetAppender, RemoteSyslogAppender and the
    SmtpAppender of log4net.Ext.Mail; a fix there applies to all three.
  • With a dead sink each event waits EnqueueTimeoutMillis before it is dropped, so the logging
    thread stalls for the timeout times the number of events.
  • On Linux a connected UDP socket reports the ICMP error of one datagram on the next send, so the
    record that fails is not the one that caused it.
  • RemoteSyslogAppender already rejects an undefined NewLineHandling on activation;
    LocalSyslogAppender did not.
  • No new public API in a patch release; a hidden helper may break its signature on purpose.

Changes

  1. Background senders wait per event when the queue is full and report the close summary twice #370 The close summary is reported once per count: the sender keeps the count it last reported.
  2. Background senders wait per event when the queue is full and report the close summary twice #370 After an enqueue timed out, later events drop at once until a send succeeds; the pump
    clears the flag. Reports say "message", as for all three appenders.
  3. RemoteSyslogAppender loses the record after an ICMP error #371 RemoteSyslogAppender.Send sends once more after a SocketException; the error is
    reported.
  4. LocalSyslogAppender lets an undefined NewLineHandling and other line breaks through raw #372 LocalSyslogAppender.ActivateOptions rejects an undefined NewLineHandling; a value set
    later is escaped.
  5. LocalSyslogAppender lets an undefined NewLineHandling and other line breaks through raw #372 Escape and Split write VT, FF, FS, GS, RS, NEL, U+2028 and U+2029 as \uXXXX; Keep
    stays raw.
  6. LocalSyslogAppender lets an undefined NewLineHandling and other line breaks through raw #372 SystemInfo.CreateArgumentOutOfRangeException takes the parameter name from
    CallerArgumentExpression and is hidden from IntelliSense; all call sites drop the name.

Docs: a shared partial background-sender.adoc for the Telnet, RemoteSyslog and Smtp pages, the
remotesyslog size limits on the MTU case, the localsyslog newline handling, XML doc comments of the
changed members. One changelog entry per change in src/changelog/3.6.1.

Sequencing

  1. The close summary first; the later tests expect it once.
  2. The congested flag on top, same file.
  3. The syslog retry.
  4. The NewLineHandling range check, then the other line breaks in the same switch.
  5. The parameter name last; it adds a call site from step 4.
  6. Each commit: test against the unfixed code first, fix, mutate each changed line, review loop.

Verification

  • dotnet build of all targets with 0 warnings, tests on net10 and, on Windows, net462.
  • A recording sink pins sends, reports and the close summary of BackgroundSender.
  • A full queue: the first event waits, the next ones drop at once, a successful send restores the
    wait.
  • A UDP mock throws a SocketException once: the record is sent on the second try and the error
    reported.
  • LocalSyslogAppender: an undefined value fails activation; each of the eight line breaks is
    escaped in Escape and Split and kept in Keep.
  • ParamName checked for a range error from SystemInfo, LevelMap, an appender collection index
    and the Ext.Mail queue size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants