-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logging: Respect log-size-max immediately after open #468
Conversation
7c989bc
to
4444e76
Compare
The test that failed (
I'll assume that's unrelated and ignore it unless told otherwise. |
couple of nits, feel free to ignore the test failures :) |
4444e76
to
a03d1a7
Compare
LGTM, @giuseppe PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
could you please rebase so the CI will (hopefully) pass? |
When a container keeps restarting, conmon restarts and opens the log file with O_APPEND every single time, resetting bytes_written to 0 with a non-empty file. If the container fails before writting log-size-max bytes then the log keeps growing indefinitely, potentially using up all the available space. This should be kept in check: initialize bytes_written to the file's current size, so that it can be reset if required (it's possible that the file gets re-open before the first write if it was already above the limit, but that should almost never happen in practice) In order to make this simpler make bytes written global variables Signed-off-by: Dominique Martinet <[email protected]>
a03d1a7
to
116675e
Compare
/lgtm |
It looks like that did the trick. I don't suppose there are plans for a 2.1.10 a couple of days after the 2.1.9 is there? :) |
this is included in 2.1.10 :) |
When a container keeps restarting, conmon restarts and opens the log file with O_APPEND every single time, resetting bytes_written to 0 with a non-empty file.
If the container fails before writting log-size-max bytes then the log keeps growing indefinitely, potentially using up all the available space.
This should be kept in check: initialize bytes_written to the file's current size, so that it can be reset if required (it's possible that the file gets re-open before the first write if it was already above the limit, but that should almost never happen in practice)
In order to make this simpler make bytes written global variables
This bit us with podman recently with a bad container config and restart=on-failure; I thought it wasn't a problem before? but checking the code I don't see how this would be a new problem, so I probably failed to check this when adding the podman
--log-opt max-size=xxx
parameter...Thanks!