Add explicit timeout to firehose collector fetch #SUPERLOG - #462
Open
superlog-app[bot] wants to merge 1 commit into
Open
Add explicit timeout to firehose collector fetch #SUPERLOG#462superlog-app[bot] wants to merge 1 commit into
superlog-app[bot] wants to merge 1 commit into
Conversation
Delivery-Id: e9162bccff1aea5f519bd9a7a8e186a1be646cd8cac33b08c3cacc870182ba16 Delivery-Base: main
| method: "POST", | ||
| headers: upstreamHeaders, | ||
| body: bodyBuffer, | ||
| signal: AbortSignal.timeout(FIREHOSE_COLLECTOR_TIMEOUT_MS), |
Contributor
Author
There was a problem hiding this comment.
logs · blocking — Log the timeout signal type when the collector POST is aborted
Add a structured timedOut: true (or abortReason) field in the outer catch when err.name === 'TimeoutError' so operators can distinguish a self-imposed 30 s abort from a collector-side TCP reset or TLS error; without it, both appear as identical 500s with no way to confirm the new timeout path is firing.
Suggested change
| signal: AbortSignal.timeout(FIREHOSE_COLLECTOR_TIMEOUT_MS), | |
| signal: AbortSignal.timeout(FIREHOSE_COLLECTOR_TIMEOUT_MS), | |
| }); | |
| // Note: if the signal fires, the catch block should check | |
| // err.name === 'TimeoutError' and log { timedOut: true, timeoutMs: FIREHOSE_COLLECTOR_TIMEOUT_MS } |
Useful? React with 👍 / 👎.
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.
Summary
The proxy's
forwardFirehosefunction POSTs AWS Data Firehose batches to the co-located OTel collector's receiver (FIREHOSE_LOGS_COLLECTOR_URL/FIREHOSE_METRICS_COLLECTOR_URL) with no explicit timeout. When the collector is briefly unresponsive, the proxy waits up to undici's internalheadersTimeout(300 s default) before propagating the error and returning 500 to Firehose. On 2026-08-09, two Firehose batches (signal=logs, both onip-10-0-12-4) hit this path and receivedHeadersTimeoutErrorat 19:55 and 19:57 UTC before the collector recovered.Root Cause
At
apps/proxy/src/index.ts:1077, thefetch(collectorUrl, { method: 'POST', … })call inforwardFirehosecarries nosignal. During a brief collector stall undici's built-in 300 s timer fires theHeadersTimeoutError, the outer catch at line 1117 returns 500 to Firehose (which is correct and retriable), but the proxy held thebufferSemaphoreslot for the full stall duration—potentially blocking concurrent firehose requests on that instance.Remediation
Adds
signal: AbortSignal.timeout(FIREHOSE_COLLECTOR_TIMEOUT_MS)(default 30 000 ms, env-overridable) to the collector POST. 30 s is well inside Firehose's 60 s endpoint-response window, so the proxy will return a 500 promptly and release the semaphore, giving Firehose time to retry before it declares a delivery failure. All 132 proxy tests pass.Incident: rusty-hedgehog (f1bff3df-30f5-4d74-8c84-0493b65b7ad2)
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Add an explicit timeout to the Firehose collector POST in the proxy. Stalled collector calls now fail within 30s instead of ~5m, freeing the semaphore and letting Firehose retry.
AbortSignal.timeout(FIREHOSE_COLLECTOR_TIMEOUT_MS)to the collectorfetchinforwardFirehose.FIREHOSE_COLLECTOR_TIMEOUT_MS, env-overridable), staying within Firehose’s 60s response window.Written for commit 96a0e65. Summary will update on new commits.