-
Notifications
You must be signed in to change notification settings - Fork 18.8k
fluentd: add write timeout log option #49911
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
Conversation
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.
+1, thanks for adding the tests.
c129735
to
fc79f13
Compare
fc79f13
to
880de67
Compare
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.
thanks! overall looking good; I left some nits and suggestions, but let me know what you think!
assert.NilError(t, err, "unable to create listener for socket %s", socketFile) | ||
defer l.Close() | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) |
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.
I was trying the test with the option disabled, and that caused it (expectedly) to hang forever; perhaps we should add a timeout here .. just in case?
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
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.
sure, sounds good.
daemon/logger/fluentd/fluentd.go
Outdated
return config, errors.Wrapf(err, "invalid value for %s: value must be a duration", writeTimeoutKey) | ||
|
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.
Stray empty line here
Thanks for reviewing this and for the comments. I can address a bulk of these and post an update. |
Thanks! Yes, give me a ping when you had time to do so; when doing so, please amend the commit (squashed); no need to keep them as separate commits ❤️ |
880de67
to
18b8834
Compare
18b8834
to
db52f6b
Compare
Currently, there's no mechanism to specify a write timeout value for fluentd connections. This means that writes can forever be blocked if the downstream connections is unhealthy. This commit makes this value configurable via a new fluentd log option called "fluentd-write-timeout". Signed-off-by: Anirudh Aithal <[email protected]>
db52f6b
to
7dae7c5
Compare
I think I've addressed all of the comments with this change: https://github.com/moby/moby/compare/db52f6b42724419a5f2140c740d5c87eae8f4534..7dae7c54dde81951330170c7678deea350b1d2b8. Can you please take another look @thaJeztah ? Thanks in advance! |
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, thanks!
Added support for
fluentd-write-timeout
configuration option in the fluentd logger to prevent indefinite blocking when downstream connections become unhealthy. This allows fluentd to abandon unresponsive connections after a specified duration instead of being blocked forever.Key changes:
writeTimeoutKey
configuration option- What I did
Modified
fluentd
logdriver code to expose a new log option. The log option can be used to specify write timeouts.- How I did it
The code change exposes the existing config to specify a write timeout value for writes to fluentd server.
- How to verify it
Added a unit test, which fails when the timeout is not specified. The test succeeds when a timeout value is specified.
- Human readable description for the release notes