FreeAndNil commented on PR #373:
URL: https://github.com/apache/logging-log4net/pull/373#issuecomment-7085991526
Implementation plan for #373, kept here for the record. Written up to
describe the change as it stands on the branch.
<details>
<summary>Plan</summary>
# 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. #370 The close summary is reported once per count: the sender keeps the
count it last reported.
2. #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. #371 `RemoteSyslogAppender.Send` sends once more after a
`SocketException`; the error is
reported.
4. #372 `LocalSyslogAppender.ActivateOptions` rejects an undefined
`NewLineHandling`; a value set
later is escaped.
5. #372 `Escape` and `Split` write VT, FF, FS, GS, RS, NEL, U+2028 and
U+2029 as `\uXXXX`; `Keep`
stays raw.
6. #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.
7. Commits and pushes are the maintainer's.
## 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.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]