Fix GCS S3 upload client timeouts#1
Merged
Conversation
…aries
GCS responses include x-goog-stored-content-length before Content-Length.
fluentbit's header_lookup() uses strcasestr("Content-Length: ") which
matches the substring inside x-goog-stored-content-length, reading the
stored object size instead of the response body length (typically 0).
This causes the HTTP client to wait for bytes that never arrive,
resulting in read timeouts and "broken connection" on every S3-to-GCS
upload.
The patch replaces the single strcasestr call with a loop that advances
past any match not preceded by \n (or at buffer start), so only actual
response header lines match. This is the minimal fix — no header
parsing rewrite — and stays correct for standard HTTP where each header
starts on its own line.
Build args FLB_TRACE and FLB_HTTP_CLIENT_DEBUG default to Off for
production; a separate debug-tagged image builds with both On.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Symptoms (observed with debug build)
Only the first write to GCS using the S3 client produces a blob. Every S3-to-GCS PutObject hangs for
net.io_timeoutseconds then fails:[error] [http_client] broken connection to storage.googleapis.com:443[error] [output:s3:s3.0] PutObject request failedRoot cause: GCS responds with
x-goog-stored-content-lengthbeforeContent-Length: 0. fluentbit'sstrcasestr("Content-Length: ")matchesinside the longer header, reads the wrong value, and waits for a response
body that never arrives.