Make stdio logging fail-soft on write errors#231
Open
dineshadhi wants to merge 1 commit into
Open
Conversation
Foundations currently wraps terminal/stderr logging drains with `Fuse` before passing them to `slog_async`. If the underlying stdout/stderr stream returns an I/O error such as `BrokenPipe`, `Fuse` turns that error into a panic in the async logging worker. This is unsafe for services whose stdout/stderr is captured by systemd and journald: if the journald stream is interrupted, normal logging can crash the service. Handle terminal and stderr output errors with `ignore_res()` instead, so stdio logging failures do not panic the async logging worker. File logging keeps the existing fused behavior. Add a regression test proving a failing async stdio drain keeps processing subsequent records instead of terminating after the first write error.
Collaborator
|
The use of
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Foundations currently wraps terminal/stderr logging drains with
Fusebefore passing them toslog_async. If the underlying stdout/stderr stream returns an I/O error such asBrokenPipe,Fuseturns that error into a panic in the async logging worker.This is unsafe for services whose stdout/stderr is captured by systemd and journald: if the journald stream is interrupted, normal logging can crash the service.
Handle terminal and stderr output errors with
ignore_res()instead, so stdio logging failures do not panic the async logging worker. File logging keeps the existing fused behavior.Add a regression test proving a failing async stdio drain keeps processing subsequent records instead of terminating after the first write error.