Repository navigation
out_forward: describe what send_timeout limits - #731
Open
Watson1978 wants to merge 3 commits into
Open
Watson1978 wants to merge 3 commits into
Watson1978 wants to merge 3 commits into
Conversation
👷 Deploy request for fluentd-docs pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for fluentd-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
kenhys
requested changes
Nov 30, 2026
kenhys
pushed a commit
to fluent/fluentd
that referenced
this pull request
Dec 1, 2026
…read (#5682) **Which issue(s) this PR fixes**: Fixes #5680 **What this PR does / why we need it**: `send_timeout` was only passed to `SO_SNDTIMEO`, which does not end a write of Ruby, so a send to a server that stopped reading blocked the flush thread until the server read again or closed the connection. The send now uses `write_nonblock` and fails with `SendTimeoutError` when it makes no progress for `send_timeout`. It is not a limit on the whole send, and a server that reads very slowly can also fail. `send_timeout 0` still means no timeout. `IO.copy_stream` is replaced by a read and write loop, so the file buffer with plain TCP no longer uses `sendfile`. Sending a 512 MiB chunk to in_forward on the same host took about 10% longer on my machine (0.47s to 0.52s). The memory buffer was not slower. `SO_LINGER` (= `send_timeout`) stays on the transfer socket, so `close` still waits until the server has the data, as before. Two things around it change. A plain TCP socket is now closed after `shutdown(:WR)` and not after `close_write`, also in the keepalive cache. Ruby keeps the GVL while it closes a socket after `close_write`, so that wait could stop every other thread, and with the new write loop it did so on every send to a receiver in the same process. Windows also needs the shutdown to close a non-blocking socket that has `SO_LINGER` and unsent data. And a `send_timeout` of 0 or below 1 second set `SO_LINGER` to 0 seconds (not on Windows), which resets the connection on `close` and can drop data. Now 0 sets no `SO_LINGER`, and a value below 1 second sets 1 second. A timed out socket does not wait for an ACK or for `SO_LINGER`. Without keepalive it is reset, because it only holds the chunk that is sent again. With `require_ack_response`, its node is also disabled at once, as after other failed sends. A keepalive socket is closed normally by the purge timer, after its unread data is dropped, because it may still hold earlier chunks. Its unsent data then stays in the kernel until the server reads or TCP gives up. Without `require_ack_response`, an earlier chunk on it can still be lost with TLS 1.3, when data from the server arrives after the close. That can already happen without keepalive. **Docs Changes**: fluent/fluentd-docs-gitbook#731 **Release Note**: out_forward: stop a send after send_timeout when the server does not read. `send_timeout` had no effect on a send before, so a small value can now fail sends to a slow server. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Shizuo Fujita <fujita@clear-code.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
send_timeout is a limit on the time without progress, not on the whole send. fluent/fluentd#5682 makes it stop a send, so describe what it limits and what changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
kenhys
force-pushed
the
out-forward-send-timeout-no-progress
branch
from
December 1, 2026 02:10
b2b2d4a to
316f874
Compare
kenhys
approved these changes
Dec 1, 2026
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.
fluent/fluentd#5682 makes
send_timeoutstop a send to a server that does not read. The page only said "The timeout time when sending event logs.", so this describes what the timeout limits: the time without progress, not the whole send. It also says that0disables it and what the behavior was before.fluent/fluentd#5682 is planned for v1.21.0 and for v1.19.5 as a backport. This should be merged after it is released.
🤖 Generated with Claude Code