logger/journald: fix tailing logs with systemd 255#47019
Merged
cpuguy83 merged 5 commits intomoby:masterfrom Jan 28, 2024
Merged
logger/journald: fix tailing logs with systemd 255#47019cpuguy83 merged 5 commits intomoby:masterfrom
cpuguy83 merged 5 commits intomoby:masterfrom
Conversation
016cceb to
54b151c
Compare
vvoland
reviewed
Jan 26, 2024
Following logs with a non-negative tail when the container log is empty is broken on the journald driver when used with systemd 255. Add tests which cover this edge case to our loggertest suite. Signed-off-by: Cory Snider <csnider@mirantis.com>
Synthesize a boot ID for journal entries fed into systemd-journal-remote, as required by systemd 255. Signed-off-by: Cory Snider <csnider@mirantis.com>
The journald reader uses a timer to set an upper bound on how long to wait for the final log message of a stopped container. However, the timer channel is only received from in non-blocking select statements! There isn't enough benefit of using a timer to offset the cost of having to manage the timer resource. Setting a deadline and comparing the current time is just as effective, without having to manage the lifecycle of any runtime resources. Signed-off-by: Cory Snider <csnider@mirantis.com>
9a4f699 to
4ecfaee
Compare
Contributor
|
LGTM; the linter has some very arguable complaint though 😭 |
While it doesn't really matter if the reader waits for an extra arbitrary period beyond an arbitrary hardcoded timeout, it's also trivial and cheap to implement, and nice to have. Signed-off-by: Cory Snider <csnider@mirantis.com>
errDrainDone is a sentinel error which is never supposed to escape the package. Consequently, it needs to be filtered out of returns all over the place, adding boilerplate. Forgetting to filter out these errors would be a logic bug which the compiler would not help us catch. Replace it with boolean multi-valued returns as they can't be accidentally ignored or propagated. Signed-off-by: Cory Snider <csnider@mirantis.com>
4ecfaee to
905477c
Compare
vvoland
approved these changes
Jan 26, 2024
cpuguy83
approved these changes
Jan 28, 2024
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.
- What I did
- How I did it
By fixing the journald reader to no longer rely upon an invalid assumption about the
sd-journalreader API. See the individual commit messages for more details.- How to verify it
The journald reader tests pass in the dev container / CI (systemd 253) and in an archlinux container with systemd 255 installed.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)