Skip to content

out_forward: describe what send_timeout limits - #731

Open
Watson1978 wants to merge 3 commits into
fluent:1.0from
Watson1978:out-forward-send-timeout-no-progress
Open

Watson1978 wants to merge 3 commits into
fluent:1.0from
Watson1978:out-forward-send-timeout-no-progress

Conversation

@Watson1978

@Watson1978 Watson1978 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

fluent/fluentd#5682 makes send_timeout stop 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 that 0 disables 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

@netlify

netlify Bot commented Nov 26, 2026

Copy link
Copy Markdown

👷 Deploy request for fluentd-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit ee459cf

@netlify

netlify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for fluentd-docs ready!

Name Link
🔨 Latest commit 316f874
🔍 Latest deploy log https://app.netlify.com/projects/fluentd-docs/deploys/6b0e2c887d27d1af7799dfb2
😎 Deploy Preview https://deploy-preview-731--fluentd-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread output/forward.md Resolved
@kenhys kenhys added the pending To be done in the future label Nov 30, 2026
@Watson1978
Watson1978 requested a review from kenhys December 1, 2026 00:49
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>
Watson1978 and others added 3 commits December 1, 2026 11:10
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
kenhys force-pushed the out-forward-send-timeout-no-progress branch from b2b2d4a to 316f874 Compare December 1, 2026 02:10
@Watson1978 Watson1978 added this to the fluentd-v1.19.5 milestone Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending To be done in the future

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants